forked from ConsultingMD/homebrew-ih-public
-
Notifications
You must be signed in to change notification settings - Fork 0
/
add-step
executable file
·66 lines (50 loc) · 1.14 KB
/
add-step
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
function usage() {
cat <<USAGE
add-step NAMESPACE STEP
Creates a new step named STEP in the NAMESPACE folder.
USAGE
exit 1
}
if [[ $# -lt 2 ]]; then
usage
fi
NAMESPACE=${1}
STEP=${2}
THIS_DIR=$(dirname "$(realpath "$0")")
NAMESPACE_DIR="$THIS_DIR/..//lib/$NAMESPACE"
mkdir -p "$NAMESPACE_DIR"
STEP_DIR="$NAMESPACE_DIR/$STEP"
if [[ -d $STEP_DIR ]]; then
echo "A step named $STEP already exists"
return 1
fi
function step-template() {
cat <<END
#!/bin/bash
# IH_CORE_DIR will be set to the directory containing the bin and lib directories.
function ih::setup::$STEP::help(){
echo 'Summary line about this step
This step will:
- detail
- detail
'
}
# Check if the step has been installed and return 0 if it has.
# Otherwise return 1.
function ih::setup::$STEP::test(){
echo "Step installed"
return 0
}
# Echo a space-delimited list of steps which must be installed before this one can be.
function ih::setup::$STEP::deps(){
# echo "step1 step2"
echo ""
}
function ih::setup::$STEP::install(){
echo 'Installing...'
}
END
}
mkdir -p "$STEP_DIR"
step-template >"$STEP_DIR/step.sh"