chore: fix new.sh (#36)

Co-authored-by: Muhammad Atif Ali <atif@coder.com>
pull/39/head
Ben Potter 2 years ago committed by GitHub
parent 22184ef4d2
commit b18ac37cbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4,14 +4,14 @@ description: Describe what this module does
icon: ../.icons/<A_RELEVANT_ICON>.svg
maintainer_github: GITHUB_USERNAME
verified: false
tags: [community]
tags: [helper]
---
# 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
module "MODULE_NAME" {
@ -62,3 +62,4 @@ module "MODULE_NAME" {
agent_id = coder_agent.example.id
offline = true
}
```

@ -11,7 +11,7 @@ if [ -z "$MODULE_NAME" ]; then
exit 1
fi
# Create module directory and exist if it alredy exists
# Create module directory and exit if it alredy exists
if [ -d "$MODULE_NAME" ]; then
echo "Module with name $MODULE_NAME already exists"
echo "Please choose a different name"
@ -25,7 +25,13 @@ cp -r .sample/* "${MODULE_NAME}"
# Change to module directory
cd "${MODULE_NAME}"
# Update main.tf with module name
sed -i "s/MODULE_NAME/${MODULE_NAME}/g" main.tf
# Update README.md with module name
sed -i "s/MODULE_NAME/${MODULE_NAME}/g" README.md
# Detect OS
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
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
module "vscode-web" {
source = "https://registry.coder.com/modules/vscode-web"
agent_id = coder_agent.example.id
version = "1.82.0"
folder = "/home/coder/my-projet"
acept_license = true
source = "https://registry.coder.com/modules/vscode-web"
agent_id = coder_agent.example.id
version = "1.82.0"
folder = "/home/coder/my-projet"
accept_license = true
}
```

Loading…
Cancel
Save