commit 1df9404e91af9b9470d010c5c8b7007c45822e0e from: Paul W. Rankin date: Thu Oct 24 08:21:13 2024 UTC Neaten getopts case commit - 5bf861ab17ad04f1b9e3958244f12bcc0356bf65 commit + 1df9404e91af9b9470d010c5c8b7007c45822e0e blob - b840f84548d3219d5a8c1f8db3dd44381149149f (mode 755) blob + ebc611e7ef01fe15716900c0d059d234da4bd511 (mode 644) --- t_done.sh +++ t_done.sh @@ -173,24 +173,22 @@ t_openurl() { t_select "$1" | grep -Eo "https?://[^ ]+" | xargs open } -while getopts ':ab:Dd:ehk:nSs:Tz:' opt; do +while getopts :ab:Dd:ehk:nS:s:Tz: opt; do case $opt in (h) usage ;; - (a) showall=0;; - (b) openurl=$OPTARG;; - (D) onlydone=0;; - (d) markdone=$OPTARG;; - (e) ${EDITOR:-vi} "$todo_file"; exit 0;; - (k) kill=$OPTARG;; - (n) export=0;; - (S) wholeword=-w;; - (s) query=$OPTARG;; - (T) due=" $(date +%F)";; - (z) toggle=$OPTARG;; - (:) printf "t: option -%s requires an argument\n" "$OPTARG" - exit 2 ;; - (*) printf "t: unrecognized option -%s\n\n" "$OPTARG" - usage ;; + (a) showall=0 ;; + (b) openurl=$OPTARG ;; + (D) onlydone=0 ;; + (d) markdone=$OPTARG ;; + (e) ${EDITOR:-vi} "$todo_file"; exit 0 ;; + (k) kill=$OPTARG ;; + (n) export=0 ;; + (S) query=$OPTARG; wholeword=-w ;; + (s) query=$OPTARG ;; + (T) due=" $(date +%F)" ;; + (z) toggle=$OPTARG ;; + (:) printf "t: option -%s requires an argument\n" "$OPTARG"; exit 2 ;; + (*) printf "t: unrecognized option -%s\n\n" "$OPTARG"; usage ;; esac done