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

View File

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