Skip to content

Commit 7f7f418

Browse files
authored
Merge pull request #28 from lb0o/master
[docs] Show the help message when using -h or --help
2 parents 97d7774 + 3151bd8 commit 7f7f418

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

talos-bootstrap

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,29 @@
77
# - https://google.github.io/styleguide/shell.xml
88
#
99

10+
show_help() {
11+
printf "USAGE:\n\t%s\n" "talos-bootstrap ACTION [OPTIONS]"
12+
printf "\nACTIONS:\n"
13+
printf "\t%s\t\t%s\n" "help" "Show this help message."
14+
printf "\t%s\t\t%s\n" "install" "Setup a node for a new or existing cluster."
15+
printf "\t%s\t\t%s\n" "upgrade" "Upgrade a node in an existing cluster."
16+
printf "\t%s\t\t%s\n" "reset" "Reset and remove a node from an existing cluster."
17+
printf "\t%s\t\t%s\n" "reboot" "Reboot a node."
18+
printf "\t%s\t%s\n" "shutdown" "Shutdown a node."
19+
printf "\t%s\t%s\n" "dashboard" "Open dashboard for a node."
20+
printf "\nOPTIONS:\n"
21+
printf "\t%s <%s>\t%s\n" "-n, --node" "address" "Node address"
22+
}
23+
1024
node=
1125
OP=
1226
while [ $# -gt 0 ]; do
1327
key="$1"
1428
case $key in
29+
-h|--help)
30+
show_help
31+
exit 0
32+
;;
1533
-n | --node)
1634
node="$2"
1735
shift
@@ -41,17 +59,7 @@ case "$OP" in
4159
OPTS="--talosconfig=talosconfig"
4260
;;
4361
*)
44-
printf "USAGE:\n\t%s\n" "talos-bootstrap ACTION [OPTIONS]"
45-
printf "\nACTIONS:\n"
46-
printf "\t%s\t\t%s\n" "help" "Show this help message."
47-
printf "\t%s\t\t%s\n" "install" "Setup a node for a new or existing cluster."
48-
printf "\t%s\t\t%s\n" "upgrade" "Upgrade a node in an existing cluster."
49-
printf "\t%s\t\t%s\n" "reset" "Reset and remove a node from an existing cluster."
50-
printf "\t%s\t\t%s\n" "reboot" "Reboot a node."
51-
printf "\t%s\t%s\n" "shutdown" "Shutdown a node."
52-
printf "\t%s\t%s\n" "dashboard" "Open dashboard for a node."
53-
printf "\nOPTIONS:\n"
54-
printf "\t%s <%s>\t%s\n" "-n, --node" "address" "Node address"
62+
show_help
5563
exit 1
5664
;;
5765
esac

0 commit comments

Comments
 (0)