From b18ac37cbbb2a6c0d939f70e6a07c07712545861 Mon Sep 17 00:00:00 2001 From: Ben Potter Date: Sun, 24 Sep 2023 15:30:53 +0100 Subject: [PATCH] chore: fix new.sh (#36) Co-authored-by: Muhammad Atif Ali --- .sample/README.md | 7 ++++--- new.sh | 16 +++++++++++----- vscode-web/README.md | 10 +++++----- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/.sample/README.md b/.sample/README.md index 8581979..afbd272 100644 --- a/.sample/README.md +++ b/.sample/README.md @@ -4,14 +4,14 @@ description: Describe what this module does icon: ../.icons/.svg maintainer_github: GITHUB_USERNAME verified: false -tags: [community] +tags: [helper] --- # MODULE_NAME -<-- Describes what this module does --> + -<-- 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 } +``` diff --git a/new.sh b/new.sh index 7c68d0f..06fcc6c 100755 --- a/new.sh +++ b/new.sh @@ -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 diff --git a/vscode-web/README.md b/vscode-web/README.md index c53e1d5..5ebd8f2 100644 --- a/vscode-web/README.md +++ b/vscode-web/README.md @@ -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 } ```