Skip to content

Commit 15dca57

Browse files
committed
menu: add help and cleanup
1 parent 732889a commit 15dca57

File tree

2 files changed

+30
-10
lines changed

2 files changed

+30
-10
lines changed

install.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ do
1717
--no-ask) NOASKCONFIRM="true"
1818
;;
1919
--*) echo "bad option $1"
20+
echo "USAGE: $0 [--no-ask]"
21+
exit 1
2022
;;
2123
esac
2224
shift

menu.sh

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -359,13 +359,7 @@ function do_env_checks() {
359359
fi
360360
}
361361

362-
# ----------------------------------------------
363-
# Menu bootstrap entry point
364-
# ----------------------------------------------
365-
366-
if [[ "$*" == *"--no-check"* ]]; then
367-
echo "Skipping preflight checks."
368-
else
362+
function do_checks() {
369363
do_project_checks
370364
do_env_checks
371365
do_python3_checks
@@ -384,14 +378,27 @@ else
384378
echo " rm .docker_notinstalled || rm .docker_outofdate || rm .project_outofdate"
385379
echo ""
386380
fi
387-
fi
381+
}
382+
383+
function do_help() {
384+
echo "USAGE:
385+
$0 [OPTIONS...]"
386+
echo $'OPTIONS:
387+
--branch <name> override branch to check for updates
388+
(default: current branch)
389+
--no-check don\'t run any environment or git checks
390+
--run-env-setup try to make required user&group changes
391+
--encoding <enc> set encoding for menu'
392+
}
388393

389394
while test $# -gt 0
390395
do
391396
case "$1" in
392397
--branch) CURRENT_BRANCH=${2:-$(git name-rev --name-only HEAD)}
393398
;;
394-
--no-check) echo ""
399+
--no-check)
400+
NO_CHECK=true
401+
echo "Skipping preflight checks."
395402
;;
396403
--run-env-setup) # Sudo cannot be run from inside functions.
397404
echo "Setting up environment:"
@@ -411,12 +418,23 @@ do
411418
;;
412419
--encoding) ENCODING_TYPE=$2
413420
;;
414-
--*) echo "bad option $1"
421+
--help)
422+
do_help
423+
exit 1
424+
;;
425+
--*)
426+
echo "ERROR: unknown option: $1"
427+
do_help
428+
exit 1
415429
;;
416430
esac
417431
shift
418432
done
419433

434+
if [[ -z "$NO_CHECK" ]]; then
435+
do_checks
436+
fi
437+
420438
# This section is temporary, it's just for notifying people of potential breaking changes.
421439
if [[ -f .new_install ]]; then
422440
echo "Existing installation detected."

0 commit comments

Comments
 (0)