diff options
author | merakor <cem@ckyln.com> | 2021-08-07 22:36:04 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2021-08-07 22:36:04 +0000 |
commit | ff0623f728912b3551496d5f79cf5b6500bd0635 (patch) | |
tree | 91de93e6d1354f135db7f3b8bb810dbe37bb101d | |
parent | f973f31523242f8936ef8b04e3725352dfcadcf5 (diff) | |
download | cpt-ff0623f728912b3551496d5f79cf5b6500bd0635.tar.gz |
global_options: add compact option
FossilOrigin-Name: b4919bd0efea601d35f7009cc4de3472005d49afbe0632db68f743f7f9e07739
-rw-r--r-- | src/cpt-lib.in | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/cpt-lib.in b/src/cpt-lib.in index 0017fba..723136e 100644 --- a/src/cpt-lib.in +++ b/src/cpt-lib.in @@ -426,18 +426,22 @@ getoptions_help() { global_options() { # These are options that are supported by most utilities. If the optional # argument 'silent' is given, the usage will not print these options, but - # the arguments will still be accepted. Sometimes it doesn't make sense to - # pollute the screen with options that will be rarely ever used. + # the arguments will still be accepted. Alternatively, if the 'compact' + # argument is given, the function only prints the '--help' and '--version' + # flags. Sometimes it doesn't make sense to pollute the screen with options + # that will be rarely ever used. + _h=hidden:1 case $1 in - silent) h=hidden:1 ;; - *) msg -- '' 'Global Options:'; h='' + silent) _c=$_h ;; + compact) _c='' ;; + *) msg -- '' 'Global Options:'; _c='' _h='' esac - flag CPT_FORCE -f --force $h init:@export -- "Force operation" - flag CPT_PROMPT -y --no-prompt on:0 off:0 $h init:@export -- "Do not prompt for confirmation" - param CPT_ROOT --root $h init:@export -- "Use an alternate root directory" - disp :usage -h --help $h -- "Show this help message" - disp :version -v --version $h -- "Print version information" - flag CPT_VERBOSE --verbose $h init:@export -- "Be more verbose" + flag CPT_FORCE -f --force $_h init:@export -- "Force operation" + flag CPT_PROMPT -y --no-prompt on:0 off:0 $_h init:@export -- "Do not prompt for confirmation" + param CPT_ROOT --root $_h init:@export -- "Use an alternate root directory" + disp :usage -h --help $_c -- "Show this help message" + disp :version -v --version $_c -- "Print version information" + flag CPT_VERBOSE --verbose $_h init:@export -- "Be more verbose" } contains() { |