Sane defaults are sane

This commit is contained in:
Nox Sluijtman 2023-11-30 15:55:15 +01:00
parent 005a022307
commit a2a5318fa8
3 changed files with 11 additions and 10 deletions

View file

@ -6,6 +6,7 @@ usage(){
printf "Usage: %s -c|h\n" "$(basename $0)"
printf "OR\n"
printf "Usage: %s <bookmark-url>\n" "$(basename $0)"
exit 1
}
@ -22,10 +23,12 @@ addUrl(){
printf "added '%s' to '%s'" "$url" "$bookmarks"
}
while getopts chu: flag; do
while getopts ch: flag; do
case $flag in
c)addUrl $(xclip -o);;
u)addUrl $OPTARG;;
c)addUrl $(xclip -o) && exit 0;;
h)usage;;
esac
done
addUrl $1

View file

@ -1,8 +1,7 @@
#compdef _add-bookmark add-bookmark
_arguments : \
"(-u -h)-c[take url from clipboard]" \
"(-c -h)-u[url as argument]:bookmark url:" \
"(-u -c)-h[print usage and exit]"
"(-h)-c[take url from clipboard]" \
"(-c)-h[print usage and exit]"
_arguments : $arguments

View file

@ -6,7 +6,9 @@ add-bookmark(1)
# SYNOPSIS
*copy-bookmark -u|h|c*
*copy-bookmark -h|c*
*copy-bookmark <url>*
# DESCRIPTION
*qutebrowser(1)* saves its bookmarks in
@ -16,9 +18,6 @@ qutebrowser.
# OPTIONS
*-u*
URL given as argument
*-c*
URL read from clipboard