install.sh: support combined options (#24)

* install.sh: support combined short options

* ci: use combined opt

* debug

Co-authored-by: xiongdian.me <xiongdian.me@bytedance.com>
This commit is contained in:
Dict Xiong 2022-11-11 10:36:50 +08:00 committed by GitHub
parent 300b3a29b7
commit 9a7f0b1b06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 13 deletions

View File

@ -22,7 +22,7 @@ jobs:
run: | run: |
rev=`git rev-parse HEAD` rev=`git rev-parse HEAD`
pwd pwd
./install.sh -d -l ./install.sh -dl
test `git rev-parse HEAD` = "$rev" test `git rev-parse HEAD` = "$rev"
- name: antigen build - name: antigen build
@ -69,7 +69,7 @@ jobs:
run: | run: |
rev=`git rev-parse HEAD` rev=`git rev-parse HEAD`
pwd pwd
./install.sh -d -l ./install.sh -dl
test `git rev-parse HEAD` = "$rev" test `git rev-parse HEAD` = "$rev"
- name: antigen build - name: antigen build
@ -113,7 +113,7 @@ jobs:
- name: install dfs - name: install dfs
run: | run: |
rev=`git rev-parse HEAD` rev=`git rev-parse HEAD`
./install.sh -d -a -l ./install.sh -dal
test `git rev-parse HEAD` = "$rev" test `git rev-parse HEAD` = "$rev"
- name: antigen build with DFS_NO_WALL - name: antigen build with DFS_NO_WALL

View File

@ -253,16 +253,22 @@ uninstall(){
} }
BIN=install BIN=install
while [[ $# > 0 ]]; do ARG=""
case $1 in while [[ $# > 0 || -n "$ARG" ]]; do
-i ) BIN=install ;; if [[ -z "$ARG" ]]; then ARG=$1 ORIGIN_ARG=$1; shift; fi
-r ) BIN=uninstall ;; case $ARG in
-q|--quite ) export DFS_QUIET=1 ;; -i* ) BIN=install ;;
-d|--dev ) export DFS_DEV=1 ;; -r* ) BIN=uninstall ;;
-l|--lite ) export DFS_LITE=1 ;; -q*|--quite ) export DFS_QUIET=1 ;;
-a|--auto ) install_dependencies ;; -d*|--dev ) export DFS_DEV=1 ;;
* ) fmt_warning "unknown command \"$1\". available: -i, -r, -q, -d, -l, -a"; exit 1 ;; -l*|--lite ) export DFS_LITE=1 ;;
-a*|--auto ) install_dependencies ;;
* ) fmt_warning "unknown command \"$ORIGIN_ARG\". available: -i, -r, -q, -d, -l, -a"; exit 1 ;;
esac esac
shift if [[ "$ARG" == "--"* || ${#ARG} == 2 ]]; then
ARG=""
else
ARG=-${ARG:2}
fi
done done
$BIN $BIN