i_files to get a list of files for autocompletion - notes - a console notes manager using git Err bitreich.org 70 1Log /scm/notes/log.gph bitreich.org 70 1Files /scm/notes/files.gph bitreich.org 70 1Refs /scm/notes/refs.gph bitreich.org 70 1Tags /scm/notes/tag bitreich.org 70 1LICENSE /scm/notes/file/LICENSE.gph bitreich.org 70 i--- Err bitreich.org 70 1commit f4c996c7032765c73fdce88c65d43c8d9844e34e /scm/notes/commit/f4c996c7032765c73fdce88c65d43c8d9844e34e.gph bitreich.org 70 1parent e5b96dbf99c8250f3b5287f5c0d75dd65640edd3 /scm/notes/commit/e5b96dbf99c8250f3b5287f5c0d75dd65640edd3.gph bitreich.org 70 hAuthor: Solene Rapenne URL:mailto:solene@perso.pw bitreich.org 70 iDate: Fri, 13 Jul 2018 18:47:45 +0200 Err bitreich.org 70 i Err bitreich.org 70 i_files to get a list of files for autocompletion Err bitreich.org 70 i Err bitreich.org 70 iDiffstat: Err bitreich.org 70 i M notes | 13 +++++++++++++ Err bitreich.org 70 i Err bitreich.org 70 i1 file changed, 13 insertions(+), 0 deletions(-) Err bitreich.org 70 i--- Err bitreich.org 70 1diff --git a/notes b/notes /scm/notes/file/notes.gph bitreich.org 70 i@@ -102,6 +102,18 @@ last() { Err bitreich.org 70 i }' Err bitreich.org 70 i } Err bitreich.org 70 i Err bitreich.org 70 i+# raw list of files for completion Err bitreich.org 70 i+_completion_list() { Err bitreich.org 70 i+ if [ -d "$REPO" ] Err bitreich.org 70 i+ then Err bitreich.org 70 i+ cd "$REPO" Err bitreich.org 70 i+ find . -name '.git' -prune -o -mindepth 2 -type f -print | sed 's,^\./,,' Err bitreich.org 70 i+ else Err bitreich.org 70 i+ echo "$REPO does not exist. Aborting..." Err bitreich.org 70 i+ exit 4 Err bitreich.org 70 i+ fi Err bitreich.org 70 i+} Err bitreich.org 70 i+ Err bitreich.org 70 i # create a git repo Err bitreich.org 70 i initialization() { Err bitreich.org 70 i cd $REPO Err bitreich.org 70 i@@ -133,6 +145,7 @@ if expr "$PARAM1" : "^c" >/dev/null && [ -n "$PARAM2" ]; then show_file "$PARAM2 Err bitreich.org 70 i if [ "$PARAM1" = "rm" ] && [ -n "$PARAM2" ]; then delete "$PARAM2" ; exit 0 ; fi Err bitreich.org 70 i if expr "$PARAM1" : "^he" >/dev/null ; then usage ; exit 0 ; fi Err bitreich.org 70 i if expr "$PARAM1" : "^l" >/dev/null ; then last; exit 0 ; fi Err bitreich.org 70 i+if [ "$PARAM1" = "_files" ] ; then _completion_list ; exit 0 ; fi Err bitreich.org 70 i Err bitreich.org 70 i if [ -f "${REPO}/${PARAM1}" ] ; then edit "$PARAM1" ; exit 0 ; fi Err bitreich.org 70 i Err bitreich.org 70 .