FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
modules/new.sh at main · coder/modules · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
This repository was archived by the owner on May 15, 2025. It is now read-only.
coder
/
modules
Public archive
Notifications
You must be signed in to change notification settings
Fork
63
Star
48
Code
Pull requests
0
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
modules
/
new.sh
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
40 lines (32 loc) · 936 Bytes
Breadcrumbs
modules
/
new.sh
Copy path
File metadata and controls
executable file
·
40 lines (32 loc) · 936 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!
/usr/bin/env bash
#
This scripts creates a new sample moduledir with required files
#
Run it like : ./new.sh my-module
MODULE_NAME=
$1
#
Check if module name is provided
if
[
-z
"
$MODULE_NAME
"
]
;
then
echo
"
Usage: ./new.sh <module_name>
"
exit
1
fi
#
Create module directory and exit if it already exists
if
[
-d
"
$MODULE_NAME
"
]
;
then
echo
"
Module with name
$MODULE_NAME
already exists
"
echo
"
Please choose a different name
"
exit
1
fi
mkdir -p
"
${MODULE_NAME}
"
#
Copy required files from the sample module
cp -r .sample/
*
"
${MODULE_NAME}
"
#
Change to module directory
cd
"
${MODULE_NAME}
"
#
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
#
Make run.sh executable
chmod +x run.sh
Back
|
FazBrowse Home
|
New Git URL