From a2a5318fa8dcf68776c5c2a5aaa36117b44c5dd8 Mon Sep 17 00:00:00 2001 From: Marty Sluijtman Date: Thu, 30 Nov 2023 15:55:15 +0100 Subject: [PATCH] Sane defaults are sane --- src/bin/add-bookmark | 9 ++++++--- src/completions/_add-bookmark | 5 ++--- src/manpages/add-bookmark.1.scd | 7 +++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/bin/add-bookmark b/src/bin/add-bookmark index c8723b1..04fc155 100755 --- a/src/bin/add-bookmark +++ b/src/bin/add-bookmark @@ -6,6 +6,7 @@ usage(){ printf "Usage: %s -c|h\n" "$(basename $0)" printf "OR\n" printf "Usage: %s \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 diff --git a/src/completions/_add-bookmark b/src/completions/_add-bookmark index f161441..8574edf 100644 --- a/src/completions/_add-bookmark +++ b/src/completions/_add-bookmark @@ -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 diff --git a/src/manpages/add-bookmark.1.scd b/src/manpages/add-bookmark.1.scd index 80ad297..d3f6b9e 100644 --- a/src/manpages/add-bookmark.1.scd +++ b/src/manpages/add-bookmark.1.scd @@ -6,7 +6,9 @@ add-bookmark(1) # SYNOPSIS -*copy-bookmark -u|h|c* +*copy-bookmark -h|c* + +*copy-bookmark * # DESCRIPTION *qutebrowser(1)* saves its bookmarks in @@ -16,9 +18,6 @@ qutebrowser. # OPTIONS -*-u* - URL given as argument - *-c* URL read from clipboard