Skip to content

Commit 50478ec

Browse files
author
lb0o
committed
[docs] Show the help message when using -h or --help
Signed-off-by: lb0o <lb0o@nocilo.com>
1 parent 97d7774 commit 50478ec

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

talos-bootstrap

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,30 @@
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+
exit 1
23+
}
24+
1025
node=
1126
OP=
1227
while [ $# -gt 0 ]; do
1328
key="$1"
1429
case $key in
30+
-h|--help)
31+
show_help
32+
exit 0
33+
;;
1534
-n | --node)
1635
node="$2"
1736
shift
@@ -41,18 +60,7 @@ case "$OP" in
4160
OPTS="--talosconfig=talosconfig"
4261
;;
4362
*)
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"
55-
exit 1
63+
show_help
5664
;;
5765
esac
5866

0 commit comments

Comments
 (0)