11#! /bin/bash
2+ # vim: noexpandtab
23
34CURRENT_BRANCH=$( git name-rev --name-only HEAD)
45
@@ -359,13 +360,7 @@ function do_env_checks() {
359360 fi
360361}
361362
362- # ----------------------------------------------
363- # Menu bootstrap entry point
364- # ----------------------------------------------
365-
366- if [[ " $* " == * " --no-check" * ]]; then
367- echo " Skipping preflight checks."
368- else
363+ function do_checks() {
369364 do_project_checks
370365 do_env_checks
371366 do_python3_checks
@@ -384,14 +379,27 @@ else
384379 echo " rm .docker_notinstalled || rm .docker_outofdate || rm .project_outofdate"
385380 echo " "
386381 fi
387- fi
382+ }
383+
384+ function do_help() {
385+ echo " USAGE:
386+ $0 [OPTIONS...]"
387+ echo $' OPTIONS:
388+ --branch <name> override branch to check for updates
389+ (default: current branch)
390+ --no-check don\' t run any environment or git checks
391+ --run-env-setup try to make required user&group changes
392+ --encoding <enc> set encoding for menu'
393+ }
388394
389395while test $# -gt 0
390396do
391397 case " $1 " in
392398 --branch) CURRENT_BRANCH=${2:- $(git name-rev --name-only HEAD)}
393399 ;;
394- --no-check) echo " "
400+ --no-check)
401+ NO_CHECKS=true
402+ echo " Skipping preflight checks."
395403 ;;
396404 --run-env-setup) # Sudo cannot be run from inside functions.
397405 echo " Setting up environment:"
411419 ;;
412420 --encoding) ENCODING_TYPE=$2
413421 ;;
414- --* ) echo " bad option $1 "
422+ --help)
423+ do_help
424+ exit 1
425+ ;;
426+ --* )
427+ echo " ERROR: unknown option: $1 "
428+ do_help
429+ exit 1
415430 ;;
416431 esac
417432 shift
418433done
419434
435+ if [[ -z " $NO_CHECKS " ]]; then
436+ do_checks
437+ fi
438+
420439# This section is temporary, it's just for notifying people of potential breaking changes.
421440if [[ -f .new_install ]]; then
422441 echo " Existing installation detected."
0 commit comments