aboutsummaryrefslogtreecommitdiffstats
path: root/bash
diff options
context:
space:
mode:
authorelioat <elioat@tilde.institute>2023-02-17 19:17:29 -0500
committerelioat <elioat@tilde.institute>2023-02-17 19:17:29 -0500
commit5d777790eb6ffc1a789dd6cbc1c75eb13af586c2 (patch)
treec0ea55278a70ac1a50eb6a19d3eedd9fd0e50f12 /bash
parent9e37c712d785986bb20944ba935db5164dc03ccd (diff)
downloadtour-5d777790eb6ffc1a789dd6cbc1c75eb13af586c2.tar.gz
*
Diffstat (limited to 'bash')
-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