From 3e303a094cd6b2a2c231db0178190052e86e9911 Mon Sep 17 00:00:00 2001 From: Ryan Greenup Date: Wed, 15 Jul 2020 00:41:55 +1000 Subject: [PATCH] Prints Help for Empty Argument --- bin/cadmus | 2 ++ todo.org | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/bin/cadmus b/bin/cadmus index aedf876..ed8ee70 100755 --- a/bin/cadmus +++ b/bin/cadmus @@ -98,7 +98,9 @@ arguments () { function NoteFind() { + [[ -z "${@}" ]] && NoteFind.sh -h && exit 0 NoteFind.sh "${@:-}" + exit 0 } mytest() { diff --git a/todo.org b/todo.org index 2fb53f1..74944bd 100644 --- a/todo.org +++ b/todo.org @@ -24,13 +24,27 @@ Add Recommended Aliases to the [[file:README.md::Recommended Aliases][readme]] a *** TODO [#C] Should call emacsclient not emacs I should change the [[file:NoteFind.sh::--bind 'alt-v:execute-silent(code {}),alt-e:execute-silent(emacs {}),ctrl-o:execute-silent(xdg-open {})' \\][emacs call]] to open ~emacsclient~ instead of ~emacs~ +** DONE ~cadmus find~ Should print help when no arguments +Completed this by calling help and exiting if the arguments are empty in cadmus. + +[[file:bin/cadmus::function NoteFind() {][See here]] * Packaging ** TODO Make a Package Use [[https://fpm.readthedocs.io/en/latest/source/dir.html][FPM]] to make multiple packages bundling everything together. Consider also just using ~install --help~ and doing something [[https://www.reddit.com/r/archlinux/comments/4gsg9i/how_would_i_package_a_simple_bash_script/][like this]] or [[https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=split2flac-git][like this]]. +* Exit Codes +| Number | Description | +| 3 | File not found | +| 4 | directory not found | +| 5 | unrecognized option | +| 6 | Missing Dependency | + +#+begin_quote +Exit Code Number ∉ {1, 2, 126, 127, 128, 130, 255} +#+end_quote * Footnotes [fn:2] This could so something like ~pandoc -o /tmp/myfile.odt; xdg-open /tmp/myfile.odt~