kiss: CRUX style usage fixes

This commit is contained in:
Dylan Araps 2020-05-18 11:44:24 +03:00
parent d224ccad0a
commit f41a014104
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E

15
kiss
View File

@ -1479,6 +1479,14 @@ args() {
die "Arguments contain invalid characters: '!*[]' ($*)" die "Arguments contain invalid characters: '!*[]' ($*)"
esac esac
# CRUX style usage using the current directory as the name of the package
# to be operated on. This needs to sit before the 'as_root()' calls as
# they reset the current working directory during their invocations.
[ "$1" ] || case $action in b|build|c|checksum|i|install|r|remove)
export KISS_PATH=${PWD%/*}:$KISS_PATH
set -- "${PWD##*/}"
esac
# Parse some arguments earlier to remove the need to duplicate code. # Parse some arguments earlier to remove the need to duplicate code.
case $action in case $action in
s|search) s|search)
@ -1504,13 +1512,6 @@ args() {
;; ;;
esac esac
# Second early check to use $PWD in place of arguments.
[ "$1" ] || case $action in b|build|c|checksum|i|install|r|remove)
export KISS_PATH=${PWD%/*}:$KISS_PATH
args "$action" "${PWD##*/}"
return 0
esac
# Actions can be abbreviated to their first letter. This saves # Actions can be abbreviated to their first letter. This saves
# keystrokes once you memorize the commands. # keystrokes once you memorize the commands.
case $action in case $action in