add edit command back for special cases - notes - a console notes manager using git DIR Log DIR Files DIR Refs DIR Tags DIR LICENSE --- DIR commit b048880ad42ba99c6e5cba227505724d3b501ad2 DIR parent 901af4715f8b6dd389b9d047a4ff15e769b61723 HTML Author: Solene Rapenne <solene@perso.pw> Date: Sat, 14 Jul 2018 11:17:16 +0200 add edit command back for special cases Diffstat: M notes | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) --- DIR diff --git a/notes b/notes @@ -34,7 +34,7 @@ usage() { ': output content of the file' \ "$name rm PATH" \ ': delete file' \ - "$name PATH" \ + "$name [edit] PATH" \ ": start \$EDITOR ($EDITOR) on file and auto commit" } @@ -128,19 +128,21 @@ then exit 2 fi -if [ -f "$REPO/$1" ]; then - edit "$1" - exit 0 -fi - case "$1" in - '') display ;; - "ls") display ;; - "i*") initialization ;; + '') display ;; + "ls") display ;; + "i*") initialization ;; "la*") last ;; + "e*") [ -n "$2" ] && edit "$2" ;; "hi*") [ -n "$2" ] && histo "$2" ;; - "c*") [ -n "$2" ] && show_file "$2" ;; - "r*") [ -n "$2" ] && delete "$2" ;; + "c*") [ -n "$2" ] && show_file "$2" ;; + "r*") [ -n "$2" ] && delete "$2" ;; "_files") _completion_list ;; - *) usage && exit 1 ;; esac + +if [ -f "$REPO/$1" ]; then + edit "$1" + exit 0 +fi + +usage && exit 1