aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <chaffinach+git@protonmail.ch>2022-01-13 19:54:24 +0000
committerMatthew Lemon <chaffinach+git@protonmail.ch>2022-01-13 19:54:24 +0000
commit550fcb6248cc60197ce1417cb2960a24851cdceb (patch)
tree8b0f7b5021d98307c07e64cd53d642841fca2d43
parent908398bd42814193ac59957f8b8fd7c3b8b8c264 (diff)
handles command line arguments better
-rwxr-xr-xgrepjournal6
1 files changed, 6 insertions, 0 deletions
diff --git a/grepjournal b/grepjournal
index 0e2e87e..a6194a7 100755
--- a/grepjournal
+++ b/grepjournal
@@ -6,10 +6,16 @@
# [[ -z "$2" ]] && [[ -n "$1" ]] && searchterm="$1"
# [[ -n "$2" ]] && [[ -n "$1" ]] && searchterm="$1" && flag="$2"
+[[ $# -eq 0 ]] && echo "Do grepnotes -h"; exit 1
+
while [[ $# -gt 0 ]]; do
if [[ "$1" = "-i" ]]; then
flag="-i"
shift
+ elif [[ "$1" = "-h" ]] || [[ "$1" = "--help" ]]; then
+ echo "Usage: grepjournal [WORD] [-i (case insensitve)] [-h (display this help)]"
+ echo " Searches for WORD within all files within ~/Notes/journal. Displayed sorted by date."
+ exit
else
searchterm=$1
shift