From 18bde238ac264b1d2e412ece932875f98b485a66 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Wed, 5 Jul 2023 12:09:59 +0530 Subject: dbook: make usage a function --- dbook | 28 +++++++++++++++++----------- 1 file 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 [name], inset a new entry + -s [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)}" -- cgit v1.2.3