chore: fix new.sh (#36)
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
This commit is contained in:
@@ -4,14 +4,14 @@ description: Describe what this module does
|
|||||||
icon: ../.icons/<A_RELEVANT_ICON>.svg
|
icon: ../.icons/<A_RELEVANT_ICON>.svg
|
||||||
maintainer_github: GITHUB_USERNAME
|
maintainer_github: GITHUB_USERNAME
|
||||||
verified: false
|
verified: false
|
||||||
tags: [community]
|
tags: [helper]
|
||||||
---
|
---
|
||||||
|
|
||||||
# MODULE_NAME
|
# MODULE_NAME
|
||||||
|
|
||||||
<-- Describes what this module does -->
|
<!-- Describes what this module does -->
|
||||||
|
|
||||||
<-- Add a screencast or screenshot here -->
|
<!-- Add a screencast or screenshot here -->
|
||||||
|
|
||||||
```hcl
|
```hcl
|
||||||
module "MODULE_NAME" {
|
module "MODULE_NAME" {
|
||||||
@@ -62,3 +62,4 @@ module "MODULE_NAME" {
|
|||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
offline = true
|
offline = true
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
|||||||
16
new.sh
16
new.sh
@@ -11,7 +11,7 @@ if [ -z "$MODULE_NAME" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create module directory and exist if it alredy exists
|
# Create module directory and exit if it alredy exists
|
||||||
if [ -d "$MODULE_NAME" ]; then
|
if [ -d "$MODULE_NAME" ]; then
|
||||||
echo "Module with name $MODULE_NAME already exists"
|
echo "Module with name $MODULE_NAME already exists"
|
||||||
echo "Please choose a different name"
|
echo "Please choose a different name"
|
||||||
@@ -25,7 +25,13 @@ cp -r .sample/* "${MODULE_NAME}"
|
|||||||
# Change to module directory
|
# Change to module directory
|
||||||
cd "${MODULE_NAME}"
|
cd "${MODULE_NAME}"
|
||||||
|
|
||||||
# Update main.tf with module name
|
# Detect OS
|
||||||
sed -i "s/MODULE_NAME/${MODULE_NAME}/g" main.tf
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
# Update README.md with module name
|
# macOS
|
||||||
sed -i "s/MODULE_NAME/${MODULE_NAME}/g" README.md
|
sed -i '' "s/MODULE_NAME/${MODULE_NAME}/g" main.tf
|
||||||
|
sed -i '' "s/MODULE_NAME/${MODULE_NAME}/g" README.md
|
||||||
|
else
|
||||||
|
# Linux
|
||||||
|
sed -i "s/MODULE_NAME/${MODULE_NAME}/g" main.tf
|
||||||
|
sed -i "s/MODULE_NAME/${MODULE_NAME}/g" README.md
|
||||||
|
fi
|
||||||
|
|||||||
@@ -27,10 +27,10 @@ Automatically install [VS Code](https://code.visualstudio.com) in a workspace, c
|
|||||||
|
|
||||||
```hcl
|
```hcl
|
||||||
module "vscode-web" {
|
module "vscode-web" {
|
||||||
source = "https://registry.coder.com/modules/vscode-web"
|
source = "https://registry.coder.com/modules/vscode-web"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
version = "1.82.0"
|
version = "1.82.0"
|
||||||
folder = "/home/coder/my-projet"
|
folder = "/home/coder/my-projet"
|
||||||
acept_license = true
|
accept_license = true
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user