diff options
author | merakor <cem@ckyln.com> | 2020-11-09 13:03:20 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2020-11-09 13:03:20 +0000 |
commit | 13e58869dc0bf24acacc98650ef95d0d27598a4f (patch) | |
tree | e3b38f9315cb7545f1d3d3154c9f1d002e897479 /src/cpt-install | |
parent | 85a95118d4427f9d49a227f91f379be5bec385e3 (diff) | |
download | cpt-13e58869dc0bf24acacc98650ef95d0d27598a4f.tar.gz |
getoptions(): parse the options during main() call on cpt-lib
Calling parse() after cpt-lib has been called causes sys_db to be initiated
using the wrong CPT_ROOT, among other issues. By calling the option parser
during the main(), we make sure that the options parsed are used as soon as
possible.
FossilOrigin-Name: 2933b99bec8ec9c3f20143e2a19c270a6d208f723d2b394c625cbc13d2625326
Diffstat (limited to 'src/cpt-install')
-rwxr-xr-x | src/cpt-install | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/cpt-install b/src/cpt-install index 4dadcda..b046e02 100755 --- a/src/cpt-install +++ b/src/cpt-install @@ -1,8 +1,6 @@ #!/bin/sh # Install a package -if [ -f ./cpt-lib ]; then . ./cpt-lib; else . cpt-lib; fi - parser_definition() { setup REST help:usage -- "usage: ${0##*/} [pkg...]" msg -- '' 'Options:' @@ -10,10 +8,7 @@ parser_definition() { global_options } -eval "$(getoptions parser_definition parse "$0")" - -parse "$@" -eval set -- "$REST" +if [ -f ./cpt-lib ]; then . ./cpt-lib; else . cpt-lib; fi [ "$1" ] || set -- "${PWD##*/}"; export CPT_PATH=${PWD%/*}:$CPT_PATH |