From 2334d88b0cc7ed6944a5aaa228a091eae74ccb6a Mon Sep 17 00:00:00 2001 From: Jon Lewis Date: Mon, 5 Feb 2018 18:38:57 -0600 Subject: [PATCH] Print nothing for empty stores --- vns | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/vns b/vns index d67fe55..0c36446 100755 --- a/vns +++ b/vns @@ -112,14 +112,18 @@ vns_list () { # Prints a tree containing all notes in the notebook # If no notebook is specified, the entire store is used + numNotes () { find . -name "*.gpg" \( ! -regex '.*/\..*' \) | wc -l; } + # Check for default behavior if [ -z "${*:1:1}" ]; then readonly NOTEBOOK="" - printf "%s\n" "Store" - else + if [ "$(numNotes)" != "0" ];then + printf "%s\n" "Store" + fi + else readonly NOTEBOOK="$1" printf "%s\n" "$1" - fi + fi tree -C --noreport --prune "$VNS_STORE/$NOTEBOOK"\ | tail -n +2\