diff options
author | elioat <elioat@tilde.institute> | 2023-02-17 19:38:25 -0500 |
---|---|---|
committer | elioat <elioat@tilde.institute> | 2023-02-17 19:38:25 -0500 |
commit | 5e250cb95bb5b89f3af612a919d2445631b51fab (patch) | |
tree | 27fa2e45753a35746193584251738fbf8f523305 | |
parent | 5d777790eb6ffc1a789dd6cbc1c75eb13af586c2 (diff) | |
download | tour-5e250cb95bb5b89f3af612a919d2445631b51fab.tar.gz |
*
-rwxr-xr-x | bash/moon-maker/mm | 11 | ||||
-rw-r--r-- | bash/moon-maker/test.c | 9 |
2 files changed, 18 insertions, 2 deletions
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 <u.h> +#include <libc.h> + +void +main(void) +{ + print("hello, world\n"); + exits(0); +} \ No newline at end of file |