From 5e250cb95bb5b89f3af612a919d2445631b51fab Mon Sep 17 00:00:00 2001 From: elioat Date: Fri, 17 Feb 2023 19:38:25 -0500 Subject: * --- bash/moon-maker/mm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'bash/moon-maker/mm') diff --git a/bash/moon-maker/mm b/bash/moon-maker/mm index 30cd4a9..ee66c5e 100755 --- a/bash/moon-maker/mm +++ b/bash/moon-maker/mm @@ -8,6 +8,8 @@ if [[ "${TRACE-0}" == "1" ]]; then fi +SHORT_RAND=$(openssl rand -base64 6) + help_text() { echo ' Moon Maker @@ -40,10 +42,15 @@ elif [[ "${1-}" =~ ^-*i(nit)?$ ]]; then " fi elif [[ "${1-}" =~ ^-*o(pen)?$ ]]; then - echo "open" + $EDITOR "$2" exit elif [[ "${1-}" =~ ^-*a(dd)?$ ]]; then - echo "add" + if [ $# -ge 3 ]; then + FILE_TYPE="$3" # optionally pass a file type you'd like to append to the moon + else + FILE_TYPE="txt" # if you don't provide a file type, assume .txt for the new moon + fi + echo "$2"."$SHORT_RAND"."$FILE_TYPE" exit elif [[ "${1-}" =~ ^-*d(elete)?$ ]]; then echo "delete" -- cgit 1.4.1-2-gfad0