diff options
24 files changed, 55 insertions, 4 deletions
diff --git a/bash/moon-maker/.moons/stars.forth.2EEruXjL.php b/bash/moon-maker/.moons/stars.forth.2EEruXjL.php new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bash/moon-maker/.moons/stars.forth.2EEruXjL.php diff --git a/bash/moon-maker/.moons/stars.forth.4uvz03Ap.php b/bash/moon-maker/.moons/stars.forth.4uvz03Ap.php new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bash/moon-maker/.moons/stars.forth.4uvz03Ap.php diff --git a/bash/moon-maker/.moons/stars.forth.7RMMd_EM.php b/bash/moon-maker/.moons/stars.forth.7RMMd_EM.php new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bash/moon-maker/.moons/stars.forth.7RMMd_EM.php diff --git a/bash/moon-maker/.moons/stars.forth.A6q1V5mS.txt b/bash/moon-maker/.moons/stars.forth.A6q1V5mS.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bash/moon-maker/.moons/stars.forth.A6q1V5mS.txt diff --git a/bash/moon-maker/.moons/stars.forth.AwamuPeT.php b/bash/moon-maker/.moons/stars.forth.AwamuPeT.php new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bash/moon-maker/.moons/stars.forth.AwamuPeT.php diff --git a/bash/moon-maker/.moons/stars.forth.BcmZ9MKy.c b/bash/moon-maker/.moons/stars.forth.BcmZ9MKy.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bash/moon-maker/.moons/stars.forth.BcmZ9MKy.c diff --git a/bash/moon-maker/.moons/stars.forth.BsP2wR6s.php b/bash/moon-maker/.moons/stars.forth.BsP2wR6s.php new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bash/moon-maker/.moons/stars.forth.BsP2wR6s.php diff --git a/bash/moon-maker/.moons/stars.forth.Bxy0fdVU.txt b/bash/moon-maker/.moons/stars.forth.Bxy0fdVU.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bash/moon-maker/.moons/stars.forth.Bxy0fdVU.txt diff --git a/bash/moon-maker/.moons/stars.forth.EuFSfOF1.scm b/bash/moon-maker/.moons/stars.forth.EuFSfOF1.scm new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bash/moon-maker/.moons/stars.forth.EuFSfOF1.scm diff --git a/bash/moon-maker/.moons/stars.forth.H8AC1bT0.txt b/bash/moon-maker/.moons/stars.forth.H8AC1bT0.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bash/moon-maker/.moons/stars.forth.H8AC1bT0.txt diff --git a/bash/moon-maker/.moons/stars.forth.ISg3Mj1s.php b/bash/moon-maker/.moons/stars.forth.ISg3Mj1s.php new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bash/moon-maker/.moons/stars.forth.ISg3Mj1s.php diff --git a/bash/moon-maker/.moons/stars.forth.Sixy2Ac9.php b/bash/moon-maker/.moons/stars.forth.Sixy2Ac9.php new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bash/moon-maker/.moons/stars.forth.Sixy2Ac9.php diff --git a/bash/moon-maker/.moons/stars.forth.V4Syxtq0.cpp b/bash/moon-maker/.moons/stars.forth.V4Syxtq0.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bash/moon-maker/.moons/stars.forth.V4Syxtq0.cpp diff --git a/bash/moon-maker/.moons/stars.forth.YmpYiozi.php b/bash/moon-maker/.moons/stars.forth.YmpYiozi.php new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bash/moon-maker/.moons/stars.forth.YmpYiozi.php diff --git a/bash/moon-maker/.moons/stars.forth.gU70oHpV.lisp b/bash/moon-maker/.moons/stars.forth.gU70oHpV.lisp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bash/moon-maker/.moons/stars.forth.gU70oHpV.lisp diff --git a/bash/moon-maker/.moons/stars.forth.o3rS3aXl.php b/bash/moon-maker/.moons/stars.forth.o3rS3aXl.php new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bash/moon-maker/.moons/stars.forth.o3rS3aXl.php diff --git a/bash/moon-maker/.moons/stars.forth.rgEcfVrd.cpp b/bash/moon-maker/.moons/stars.forth.rgEcfVrd.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bash/moon-maker/.moons/stars.forth.rgEcfVrd.cpp diff --git a/bash/moon-maker/.moons/test.c.DjApQF8U.c b/bash/moon-maker/.moons/test.c.DjApQF8U.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bash/moon-maker/.moons/test.c.DjApQF8U.c diff --git a/bash/moon-maker/.moons/test.c.aUnK2SZs.txt b/bash/moon-maker/.moons/test.c.aUnK2SZs.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bash/moon-maker/.moons/test.c.aUnK2SZs.txt diff --git a/bash/moon-maker/.moons/test.c.bMU0cW1t.txt b/bash/moon-maker/.moons/test.c.bMU0cW1t.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bash/moon-maker/.moons/test.c.bMU0cW1t.txt diff --git a/bash/moon-maker/.moons/test.c.eYBzzwjx.c b/bash/moon-maker/.moons/test.c.eYBzzwjx.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bash/moon-maker/.moons/test.c.eYBzzwjx.c diff --git a/bash/moon-maker/.moons/test.c.vUaRvDNg.md b/bash/moon-maker/.moons/test.c.vUaRvDNg.md new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bash/moon-maker/.moons/test.c.vUaRvDNg.md diff --git a/bash/moon-maker/banana/kiwi/mango/strawberry/pineapple/stars.forth b/bash/moon-maker/banana/kiwi/mango/strawberry/pineapple/stars.forth new file mode 100644 index 0000000..ed9b77b --- /dev/null +++ b/bash/moon-maker/banana/kiwi/mango/strawberry/pineapple/stars.forth @@ -0,0 +1,4 @@ +: STAR [CHAR] * EMIT ; +: STARS 0 DO STAR LOOP CR ; +10 STARS +BYE \ No newline at end of file diff --git a/bash/moon-maker/mm b/bash/moon-maker/mm index 35db6c2..699d542 100755 --- a/bash/moon-maker/mm +++ b/bash/moon-maker/mm @@ -7,8 +7,48 @@ if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace fi +EDITOR="subl" -SHORT_RAND=$(openssl rand -base64 6) +add-moons () { + if [[ -d ".moons" ]]; then + touch ".moons/$1" + echo -e "A new moon is orbiting $2" + else + path=$(pwd) + while [ -n "$path" ]; do + path=${path%/*} + if [ -d "$path/.moons" ]; then + touch "$path/.moons/$1" + echo -e "A new moon is orbiting $2" + return + fi + done + fi +} + +open-moons () { + if [[ -d ".moons" ]]; then + for file in .moons/$1; do + echo -e "$file" + $EDITOR "$file" + done + else + path=$(pwd) + while [ -n "$path" ]; do + path=${path%/*} + if [ -d "$path/.moons" ]; then + for file in $path/.moons/$1; do + echo -e "$file" + $EDITOR "$file" + done + return + fi + done + fi +} + +PRE_SHORT_RAND=$(openssl rand -base64 6) +SHORT_RAND=${PRE_SHORT_RAND//\//_} help_text() { echo ' @@ -33,16 +73,19 @@ if [[ "${1-}" =~ ^-*h(elp)?$ ]]; then help_text "$@" exit elif [[ "${1-}" =~ ^-*i(nit)?$ ]]; then - if [[ -f .mm ]]; then - mkdir .mm + if [[ ! -d ".moons" ]]; then + mkdir ".moons" + echo -e "moons initialized" else echo -e " a moon maker directory already exists so you can't add another one here. " fi + exit elif [[ "${1-}" =~ ^-*o(pen)?$ ]]; then $EDITOR "$2" + open-moons "$2*" exit elif [[ "${1-}" =~ ^-*a(dd)?$ ]]; then if [ $# -ge 3 ]; then @@ -51,7 +94,7 @@ elif [[ "${1-}" =~ ^-*a(dd)?$ ]]; then FILE_TYPE="txt" # if you don't provide a file type, assume .txt for the new moon fi NEW_MOON="$2"."$SHORT_RAND"."$FILE_TYPE" - echo "$NEW_MOON" + add-moons "$NEW_MOON" "$2" exit elif [[ "${1-}" =~ ^-*d(elete)?$ ]]; then echo "delete" @@ -62,6 +105,10 @@ elif [[ "${1-}" =~ ^-*c(lear)?$ ]]; then elif [[ "${1-}" =~ ^-*u(pdate)?$ ]]; then echo "update" exit +elif [[ "${1-}" =~ ^-*z(eplin)?$ ]]; then + echo -e "zeplin" + $EDITOR "$2" + exit fi cd "$(dirname "$0")" |