From 6f3dce69725ed40e223d1d65fe7d94222f7020c2 Mon Sep 17 00:00:00 2001 From: mtekman Date: Sun, 10 Sep 2017 22:14:27 +0200 Subject: [PATCH] simplified subdir parameter passing --- plugins/org-mode-manager/orgnotes.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/plugins/org-mode-manager/orgnotes.sh b/plugins/org-mode-manager/orgnotes.sh index 91de937d..25d6bd75 100644 --- a/plugins/org-mode-manager/orgnotes.sh +++ b/plugins/org-mode-manager/orgnotes.sh @@ -61,11 +61,15 @@ or run the install script." local file=$1 local command=$2 - + # Is file an existing subfolder? + local sub_dir="" + if [ -d ${org_dir}/$file ]; then + sub_dir=$file + file="" + fi + case $file in - "");& - --subdir=*) - local sub_dir=`echo $file | sed 's|--subdir=||'` + "") # applies to subdirs too local title="You have the following org-mode notes:" if [ "$sub_dir" != "" ]; then title=`echo $title | sed "s|:| [${sub_dir}]:|"` @@ -82,9 +86,9 @@ or run the install script." -h);& --help) echo " - `basename $0` [--help] [--sync] [--subdir=] ] [--encrypt] [--decrypt]> + `basename $0` [--help] [--sync] [sub-folder] ] [--encrypt] [--decrypt]> -Generates an org-notes file in a folder location set in the $org_loc file +Generates an org-notes file in a folder location set in the $org_loc file, or a given sub-folder "; return -1; ;;