diff options
author | merakor <cem@ckyln.com> | 2022-11-14 18:05:09 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2022-11-14 18:05:09 +0000 |
commit | 7136a4e3d8bbd63678a9f7f348c27e4a3d11b722 (patch) | |
tree | 8690e94958d5431db6c272af3787a584140c889b /src | |
parent | ba9c331949e99ac9926f27b3327dbd3a4407b875 (diff) | |
download | cpt-7136a4e3d8bbd63678a9f7f348c27e4a3d11b722.tar.gz |
cpt: tidy up and fix 'cbi' and 'bi' as functions
FossilOrigin-Name: 9a3af364db9867fd46a8ed7b0f7a0dbede3333ac222ad01610a4301122a17150
Diffstat (limited to 'src')
-rwxr-xr-x | src/cpt | 59 |
1 files changed, 44 insertions, 15 deletions
@@ -1,5 +1,48 @@ #!/bin/sh -ef +bi() { + # Build and install function for cpt. + parser_definition() { + setup REST help:usage -- "usage: ${0##*/} bi [-dtfy] [--root ROOT] [pkg...]" + msg -- '' 'Options:' + flag CPT_TEST -t --test export:1 init:@export -- "Run tests (if they exist)" + flag CPT_DEBUG -d --debug export:1 init:@export -- "Keep the build directories after operation" + flag CPT_NOSTRIP -S --nostrip export:1 init:@export -- "Don't strip debug information from the binaries" \ + "(might want to add '-g' to your '\$CFLAGS')" + global_options + } + + eval "$(getoptions parser_definition parse "$0")" + parse "$@" + eval set -- "$REST" + cpt-build "$@" + + # When building multiple packages, cpt will already ask to install + # the packages, so no need for this here. + [ "$2" ] || cpt-install "$@" +} + +cbi() { + # Checksum, build and install. + parser_definition() { + setup REST help:usage -- "usage: ${0##*/} cbi [-dtfy] [--root ROOT] [pkg...]" + msg -- '' 'Options:' + flag CPT_TEST -t --test export:1 init:@export -- "Run tests (if they exist)" + flag CPT_DEBUG -d --debug export:1 init:@export -- "Keep the build directories after operation" + flag CPT_NOSTRIP -S --nostrip export:1 init:@export -- "Don't strip debug information from the binaries" \ + "(might want to add '-g' to your '\$CFLAGS')" + flag sha -s -- "Generate checksums using the depracated sha256 algorithm" + global_options + } + + eval "$(getoptions parser_definition parse "$0")" + parse "$@" + eval set -- "$REST" + + cpt-checksum "$@"; cpt-build "$@" + [ "$2" ] || cpt-install "$@" +} + if [ -f ./cpt-lib ]; then . ./cpt-lib; else . cpt-lib; fi # If none of the tools below are specified, we will reenable glob @@ -35,21 +78,7 @@ case "$arg" in r|remove) arg=remove ;; s|search) arg=search ;; u|update) arg=update ;; - bi) - # Build and install function for cpt. - cpt-build "$@" - - # When building multiple packages, cpt will already ask to install - # the packages, so no need for this here. - [ "$2" ] || cpt-install "$@" - exit - ;; - cbi) - # Checksum, build and install. - cpt-checksum "$@"; cpt-build "$@" - [ "$2" ] || cpt-install "$@" - exit - ;; + bi|cbi) "$arg" "$@"; exit "$?" ;; *) glob=1 ;; esac |