add usage() and die()
This commit is contained in:
21
sxbm
21
sxbm
@ -24,3 +24,24 @@ ENCRYPTION="0"
|
||||
|
||||
# Auto fetch title. 1 to enable, 0 to disable
|
||||
TITLE_FETCH="1"
|
||||
|
||||
die(){
|
||||
[ -z "$1" ] ||
|
||||
printf "$@\n" > /dev/stderr
|
||||
exit 1
|
||||
}
|
||||
|
||||
usage(){
|
||||
printf "Usage: sxbm <command> [<args>]\n"
|
||||
printf "
|
||||
COMMANDS:
|
||||
add <link> [title] [+tags]
|
||||
ls|list [-c|--disable-colors] [title] [+tags]
|
||||
open [-f|--force] <line_num|title|+tags>
|
||||
rm|remove [-f|--force] <line_num|title|+tags>
|
||||
edit [line_num|title|+tags]
|
||||
-h|--help print this text and exit
|
||||
-v|--version print the version and exit\n\n"
|
||||
}
|
||||
|
||||
[ -z "$1" ] && usage && die
|
||||
|
||||
Reference in New Issue
Block a user