From 8e24a19a0d31e515d52de7087a086e1c71e7a3cf Mon Sep 17 00:00:00 2001 From: dmarakom6 Date: Fri, 12 Feb 2021 18:57:12 +0200 Subject: [PATCH] quicknote: Take a note via terminal --- util/quicknote.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 util/quicknote.sh diff --git a/util/quicknote.sh b/util/quicknote.sh new file mode 100644 index 0000000..e80dfc5 --- /dev/null +++ b/util/quicknote.sh @@ -0,0 +1,44 @@ +:<<'info' +shellnotes - quicknote.sh +(C) Dimitris Marakomihelakis +Released under the "All rights reserved" category. See the RIGHTS.txt file +in /docs/github/ for its full text. +info + +function quicknote() { +dir="$(pwd)" +me="$(whoami)" +if [ $# -eq 0 ]; then + echo -n "Enter note name: " && read notename +else + notename=$1 +fi +cd $DEFAULT_PATH +if [ -e $notename ]; then + clear + echo "This note already exists." + cd .. + echo -n "Do you want to read it?[Y/N]: " && read readquicknote + +else + touch $notename + $QUICK_NOTES_EDITOR $notename + cd $dir + clear + str="Note created in $DEFAULT_PATH" + underlines=$(echo "$str" | tr -c '\010' '-') + echo "$str\n$underlines" + +fi + +case $readquicknote in y|Y|YES|Yes|yes ) + clear + cd $DEFAULT_PATH + if [[ -e $notename ]]; then + cat $notename + else + echo "This note is blank." + fi +esac + cd $dir +} \ No newline at end of file