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 +++++++++-- bash/moon-maker/test.c | 9 +++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 bash/moon-maker/test.c (limited to 'bash') 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" diff --git a/bash/moon-maker/test.c b/bash/moon-maker/test.c new file mode 100644 index 0000000..596f5dc --- /dev/null +++ b/bash/moon-maker/test.c @@ -0,0 +1,9 @@ +#include +#include + +void +main(void) +{ + print("hello, world\n"); + exits(0); +} \ No newline at end of file -- cgit 1.4.1-2-gfad0