-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcreate.sh
More file actions
32 lines (23 loc) · 773 Bytes
/
create.sh
File metadata and controls
32 lines (23 loc) · 773 Bytes
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
#!/usr/bin/env bash
create () {
name="${2}"
version='0.1.0'
main='main'
description="${3:-"Script created with \"climate create\""}"
mkdir "$(pwd)/${name}"
touch "$(pwd)/${name}/.climate"
main_path="$(pwd)/${name}/${main}"
touch "${main_path}"
chmod +x "${main_path}"
echo "#!/usr/bin/env bash" > "${main_path}"
echo "set -o errexit -o pipefail -o nounset" >> "${main_path}"
echo "# ${name} - v${version}" >> "${main_path}"
echo "echo 'hello, world! from' ${name}" >> "${main_path}"
{ echo "NAME=${name}";
echo "VERSION=${version}";
echo "DESCRIPTION=${description}";
echo "REPOSITORY=";
echo "MAIN=${main}";
} > "$(pwd)/${name}/.climate"
echo "> Run \"climate install\" in script root to install the script"
}