aboutsummaryrefslogtreecommitdiff
path: root/dbook
diff options
context:
space:
mode:
authorsinanmohd <sinan@firemail.cc>2023-07-05 12:09:59 +0530
committersinanmohd <sinan@firemail.cc>2023-07-05 12:09:59 +0530
commit18bde238ac264b1d2e412ece932875f98b485a66 (patch)
tree89b048983eb86932c8b0452a248eb93b4810dfff /dbook
parentf34ee908f5c8a340b37b7f3cff1532aab8c196bc (diff)
dbook: make usage a function
Diffstat (limited to 'dbook')
-rwxr-xr-xdbook28
1 files changed, 17 insertions, 11 deletions
diff --git a/dbook b/dbook
index 0ca19e0..afc54a7 100755
--- a/dbook
+++ b/dbook
@@ -4,6 +4,22 @@ book_conf="${XDG_CONFIG_HOME:-$HOME/.config}/dbook/dbook.conf"
book_data="${XDG_DATA_HOME:-$HOME/.local/share}/dbook"
menu="wmenu"
+usage()
+{
+ cat <<- EOF
+ Usage: dbook command
+ a bookmark manager using dmenu
+ Commands:
+ -h show this help cruft
+ -i <bookmark string> [name], inset a new entry
+ -s <bookmark string> [name], inset a new entry and make a copy
+ -d [name], delete an entry
+ -t [name], type the data
+ -c [name], copy the date to clipboard
+
+ EOF
+}
+
note()
{
: "${1:?}"
@@ -205,17 +221,7 @@ main()
case "$1" in
-h|--help)
- cat <<- EOF
- Usage: dbook command
- a bookmark manager using dmenu
- Commands:
- -h show this help cruft
- -i [bookmark string] [bookmark name], inset a new entry
- -s [bookmark string] [bookmark name], inset a new entry and make a copy
- -d [bookmark name], delete an entry
- -t [bookmark name], type the data
- -c [bookmark name], copy the date to clipboard
- EOF
+ usage
;;
-i)
data="${2:-$(entry name)}"