about summary refs log tree commit diff stats
path: root/bash/moon-maker/mm
diff options
context:
space:
mode:
Diffstat (limited to 'bash/moon-maker/mm')
-rwxr-xr-xbash/moon-maker/mm65
1 files changed, 65 insertions, 0 deletions
diff --git a/bash/moon-maker/mm b/bash/moon-maker/mm
new file mode 100755
index 0000000..30cd4a9
--- /dev/null
+++ b/bash/moon-maker/mm
@@ -0,0 +1,65 @@
+#!/usr/bin/env bash
+
+set -o errexit
+set -o nounset
+set -o pipefail
+if [[ "${TRACE-0}" == "1" ]]; then
+    set -o xtrace
+fi
+
+
+help_text() {
+    echo '
+    Moon Maker
+
+    mm, is a small program that lets you add orbiting moons to planet files.
+
+    A planet file is one that you care about -- probably an actual file in your project.
+    Moon files orbit planets, they are disposable scratch spaces connected to planets.
+
+    usage: ./mm
+                    -i(nit)....initialize a directory to store moon files
+                    -o(pen)....open a planet file and all of its moon files
+                    -a(dd).....create a new moon file for a given planet file
+                    -d(elete)..remove a moon file by its id
+                    -c(lear)...remove all moon files for a given planet file
+                    -u(pdate)..rename a planet file and all of its moon files
+'
+}
+
+if [[ "${1-}" =~ ^-*h(elp)?$ ]]; then
+    help_text "$@"
+    exit
+elif [[ "${1-}" =~ ^-*i(nit)?$ ]]; then
+    if [[ -f .mm ]]; then
+        mkdir .mm
+    else
+        echo -e "   
+            a moon maker directory already exists 
+            so you can't add another one here.
+            "
+    fi
+elif [[ "${1-}" =~ ^-*o(pen)?$ ]]; then
+    echo "open"
+    exit
+elif [[ "${1-}" =~ ^-*a(dd)?$ ]]; then
+    echo "add"
+    exit
+elif [[ "${1-}" =~ ^-*d(elete)?$ ]]; then
+    echo "delete"
+    exit
+elif [[ "${1-}" =~ ^-*c(lear)?$ ]]; then
+    echo "clear"
+    exit
+elif [[ "${1-}" =~ ^-*u(pdate)?$ ]]; then
+    echo "update"
+    exit
+fi
+
+cd "$(dirname "$0")"
+
+main() {
+    help_text "$@"
+}
+
+main "$@"
\ No newline at end of file