_files to get a list of files for autocompletion - notes - a console notes mana… | |
Log | |
Files | |
Refs | |
Tags | |
LICENSE | |
--- | |
commit f4c996c7032765c73fdce88c65d43c8d9844e34e | |
parent e5b96dbf99c8250f3b5287f5c0d75dd65640edd3 | |
Author: Solene Rapenne <[email protected]> | |
Date: Fri, 13 Jul 2018 18:47:45 +0200 | |
_files to get a list of files for autocompletion | |
Diffstat: | |
M notes | 13 +++++++++++++ | |
1 file changed, 13 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/notes b/notes | |
@@ -102,6 +102,18 @@ last() { | |
}' | |
} | |
+# raw list of files for completion | |
+_completion_list() { | |
+ if [ -d "$REPO" ] | |
+ then | |
+ cd "$REPO" | |
+ find . -name '.git' -prune -o -mindepth 2 -type f -print | sed… | |
+ else | |
+ echo "$REPO does not exist. Aborting..." | |
+ exit 4 | |
+ fi | |
+} | |
+ | |
# create a git repo | |
initialization() { | |
cd $REPO | |
@@ -133,6 +145,7 @@ if expr "$PARAM1" : "^c" >/dev/null && [ -n "$PARAM2" ]; th… | |
if [ "$PARAM1" = "rm" ] && [ -n "$PARAM2" ]; then delete "$PARAM2" ; exit 0 ; … | |
if expr "$PARAM1" : "^he" >/dev/null ; then usage ; exit 0 ; fi | |
if expr "$PARAM1" : "^l" >/dev/null ; then last; exit 0 ; fi | |
+if [ "$PARAM1" = "_files" ] ; then _completion_list ; exit 0 ; fi | |
if [ -f "${REPO}/${PARAM1}" ] ; then edit "$PARAM1" ; exit 0 ; fi | |