Introduction
Introduction Statistics Contact Development Disclaimer Help
fix parameter handling - notes - a console notes manager using git
Log
Files
Refs
Tags
LICENSE
---
commit 41390477577874b866f2f5a2c2c3b50c71f67237
parent 3e4e0e0592a07ce3c5edbb3bad1dd9e6f50ce52b
Author: Solene Rapenne <[email protected]>
Date: Sat, 14 Jul 2018 12:32:48 +0200
fix parameter handling
Diffstat:
M notes | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
---
diff --git a/notes b/notes
@@ -1,4 +1,5 @@
#!/bin/sh
+set -x
# tool for taking notes inside a git repository
@@ -64,8 +65,14 @@ edit() {
# show file history using tig program
histo() {
cd "$REPO"
- tig "$1"
- exit 0
+ if [ -f "$1" ]
+ then
+ tig "$1"
+ exit 0
+ else
+ printf 'Aborting: "%s" file does not exist.\n' "$1"
+ exit 5
+ fi
}
# output the content of a file
@@ -138,14 +145,14 @@ then
fi
case "$1" in
- "ls") display ;;
- "i*") initialization ;;
- "la*") last ;;
- "e*") [ -n "$2" ] && edit "$2" ;;
- "hi*") [ -n "$2" ] && histo "$2" ;;
- "r*") [ -n "$2" ] && delete "$2" ;;
- "c*") [ -n "$2" ] && show_file "$2" ;;
- "_files") _completion_list ;;
+ ls) display ;;
+ i*) initialization ;;
+ la*) last ;;
+ e*) [ -n "$2" ] && edit "$2" ;;
+ hi*) [ -n "$2" ] && histo "$2" ;;
+ r*) [ -n "$2" ] && delete "$2" ;;
+ c*) [ -n "$2" ] && show_file "$2" ;;
+ _files) _completion_list ;;
esac
if [ -f "$REPO/$1" ]; then
@@ -153,4 +160,4 @@ if [ -f "$REPO/$1" ]; then
exit 0
fi
-usage && exit 1
+#usage && exit 1
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.