Skip to content

Commit

Permalink
deploy: add --help option
Browse files Browse the repository at this point in the history
If receiving bad arguments, the help text is also shown, but on stderr.
  • Loading branch information
bjornfor committed Feb 7, 2025
1 parent a89dc04 commit 365a476
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions openwrt/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -203,18 +203,32 @@ let
command scp -Op ${sshOpts} "$@"
}
usage() {
echo "usage: $(basename "$0") [options]"
echo
echo "options:"
echo " --help Show this help"
echo " --reload Reload/deploy config without rebooting"
}
main() {
RELOAD_ONLY=false
TIMEOUT=${toString rebootTimeout}s
for arg in "$@"; do
case "$arg" in
--help)
usage
exit 0
;;
--reload)
RELOAD_ONLY=true
TIMEOUT=${toString reloadTimeout}s
;;
*)
echo "error: unknown argument: $arg" >&2
echo >&2
usage >&2
exit 1
;;
esac
Expand Down

0 comments on commit 365a476

Please sign in to comment.