From b54b74ad96e9d1854f9bac72cb129908f5261a37 Mon Sep 17 00:00:00 2001 From: elioat Date: Sat, 18 Feb 2023 00:21:29 -0500 Subject: * --- bash/moon-maker/.moons/plan9.c.DjApQF8U.c | 0 bash/moon-maker/.moons/plan9.c.aUnK2SZs.txt | 0 bash/moon-maker/.moons/plan9.c.eYBzzwjx.c | 0 bash/moon-maker/.moons/plan9.c.vUaRvDNg.md | 0 bash/moon-maker/.moons/stars.forth.2EEruXjL.php | 0 bash/moon-maker/.moons/stars.forth.4uvz03Ap.php | 0 bash/moon-maker/.moons/stars.forth.7RMMd_EM.php | 0 bash/moon-maker/.moons/stars.forth.A6q1V5mS.txt | 0 bash/moon-maker/.moons/stars.forth.AwamuPeT.php | 0 bash/moon-maker/.moons/stars.forth.BcmZ9MKy.c | 0 bash/moon-maker/.moons/stars.forth.BsP2wR6s.php | 0 bash/moon-maker/.moons/stars.forth.Bxy0fdVU.txt | 0 bash/moon-maker/.moons/stars.forth.EuFSfOF1.scm | 0 bash/moon-maker/.moons/stars.forth.H8AC1bT0.txt | 0 bash/moon-maker/.moons/stars.forth.ISg3Mj1s.php | 0 bash/moon-maker/.moons/stars.forth.Sixy2Ac9.php | 0 bash/moon-maker/.moons/stars.forth.V4Syxtq0.cpp | 0 bash/moon-maker/.moons/stars.forth.YmpYiozi.php | 0 bash/moon-maker/.moons/stars.forth.gU70oHpV.lisp | 0 bash/moon-maker/.moons/stars.forth.o3rS3aXl.php | 0 bash/moon-maker/.moons/stars.forth.rgEcfVrd.cpp | 0 bash/moon-maker/.moons/stars.fs.0mOZSrc4.txt | 0 bash/moon-maker/.moons/stars.fs.c+Brlwde.c | 0 bash/moon-maker/.moons/stars.fs.pZ3G2Et+.txt | 0 bash/moon-maker/.moons/test.c.DjApQF8U.c | 0 bash/moon-maker/.moons/test.c.aUnK2SZs.txt | 0 bash/moon-maker/.moons/test.c.bMU0cW1t.txt | 0 bash/moon-maker/.moons/test.c.eYBzzwjx.c | 0 bash/moon-maker/.moons/test.c.vUaRvDNg.md | 0 .../kiwi/mango/strawberry/pineapple/stars.forth | 4 -- .../kiwi/mango/strawberry/pineapple/stars.fs | 4 ++ bash/moon-maker/mm | 83 +++++++++++++++++++--- bash/moon-maker/plan9.c | 9 +++ bash/moon-maker/test.c | 9 --- 34 files changed, 88 insertions(+), 21 deletions(-) create mode 100644 bash/moon-maker/.moons/plan9.c.DjApQF8U.c create mode 100644 bash/moon-maker/.moons/plan9.c.aUnK2SZs.txt create mode 100644 bash/moon-maker/.moons/plan9.c.eYBzzwjx.c create mode 100644 bash/moon-maker/.moons/plan9.c.vUaRvDNg.md delete mode 100644 bash/moon-maker/.moons/stars.forth.2EEruXjL.php delete mode 100644 bash/moon-maker/.moons/stars.forth.4uvz03Ap.php delete mode 100644 bash/moon-maker/.moons/stars.forth.7RMMd_EM.php delete mode 100644 bash/moon-maker/.moons/stars.forth.A6q1V5mS.txt delete mode 100644 bash/moon-maker/.moons/stars.forth.AwamuPeT.php delete mode 100644 bash/moon-maker/.moons/stars.forth.BcmZ9MKy.c delete mode 100644 bash/moon-maker/.moons/stars.forth.BsP2wR6s.php delete mode 100644 bash/moon-maker/.moons/stars.forth.Bxy0fdVU.txt delete mode 100644 bash/moon-maker/.moons/stars.forth.EuFSfOF1.scm delete mode 100644 bash/moon-maker/.moons/stars.forth.H8AC1bT0.txt delete mode 100644 bash/moon-maker/.moons/stars.forth.ISg3Mj1s.php delete mode 100644 bash/moon-maker/.moons/stars.forth.Sixy2Ac9.php delete mode 100644 bash/moon-maker/.moons/stars.forth.V4Syxtq0.cpp delete mode 100644 bash/moon-maker/.moons/stars.forth.YmpYiozi.php delete mode 100644 bash/moon-maker/.moons/stars.forth.gU70oHpV.lisp delete mode 100644 bash/moon-maker/.moons/stars.forth.o3rS3aXl.php delete mode 100644 bash/moon-maker/.moons/stars.forth.rgEcfVrd.cpp create mode 100644 bash/moon-maker/.moons/stars.fs.0mOZSrc4.txt create mode 100644 bash/moon-maker/.moons/stars.fs.c+Brlwde.c create mode 100644 bash/moon-maker/.moons/stars.fs.pZ3G2Et+.txt delete mode 100644 bash/moon-maker/.moons/test.c.DjApQF8U.c delete mode 100644 bash/moon-maker/.moons/test.c.aUnK2SZs.txt delete mode 100644 bash/moon-maker/.moons/test.c.bMU0cW1t.txt delete mode 100644 bash/moon-maker/.moons/test.c.eYBzzwjx.c delete mode 100644 bash/moon-maker/.moons/test.c.vUaRvDNg.md delete mode 100644 bash/moon-maker/banana/kiwi/mango/strawberry/pineapple/stars.forth create mode 100644 bash/moon-maker/banana/kiwi/mango/strawberry/pineapple/stars.fs create mode 100644 bash/moon-maker/plan9.c delete mode 100644 bash/moon-maker/test.c (limited to 'bash') diff --git a/bash/moon-maker/.moons/plan9.c.DjApQF8U.c b/bash/moon-maker/.moons/plan9.c.DjApQF8U.c new file mode 100644 index 0000000..e69de29 diff --git a/bash/moon-maker/.moons/plan9.c.aUnK2SZs.txt b/bash/moon-maker/.moons/plan9.c.aUnK2SZs.txt new file mode 100644 index 0000000..e69de29 diff --git a/bash/moon-maker/.moons/plan9.c.eYBzzwjx.c b/bash/moon-maker/.moons/plan9.c.eYBzzwjx.c new file mode 100644 index 0000000..e69de29 diff --git a/bash/moon-maker/.moons/plan9.c.vUaRvDNg.md b/bash/moon-maker/.moons/plan9.c.vUaRvDNg.md new file mode 100644 index 0000000..e69de29 diff --git a/bash/moon-maker/.moons/stars.forth.2EEruXjL.php b/bash/moon-maker/.moons/stars.forth.2EEruXjL.php deleted file mode 100644 index e69de29..0000000 diff --git a/bash/moon-maker/.moons/stars.forth.4uvz03Ap.php b/bash/moon-maker/.moons/stars.forth.4uvz03Ap.php deleted file mode 100644 index e69de29..0000000 diff --git a/bash/moon-maker/.moons/stars.forth.7RMMd_EM.php b/bash/moon-maker/.moons/stars.forth.7RMMd_EM.php deleted file mode 100644 index e69de29..0000000 diff --git a/bash/moon-maker/.moons/stars.forth.A6q1V5mS.txt b/bash/moon-maker/.moons/stars.forth.A6q1V5mS.txt deleted file mode 100644 index e69de29..0000000 diff --git a/bash/moon-maker/.moons/stars.forth.AwamuPeT.php b/bash/moon-maker/.moons/stars.forth.AwamuPeT.php deleted file mode 100644 index e69de29..0000000 diff --git a/bash/moon-maker/.moons/stars.forth.BcmZ9MKy.c b/bash/moon-maker/.moons/stars.forth.BcmZ9MKy.c deleted file mode 100644 index e69de29..0000000 diff --git a/bash/moon-maker/.moons/stars.forth.BsP2wR6s.php b/bash/moon-maker/.moons/stars.forth.BsP2wR6s.php deleted file mode 100644 index e69de29..0000000 diff --git a/bash/moon-maker/.moons/stars.forth.Bxy0fdVU.txt b/bash/moon-maker/.moons/stars.forth.Bxy0fdVU.txt deleted file mode 100644 index e69de29..0000000 diff --git a/bash/moon-maker/.moons/stars.forth.EuFSfOF1.scm b/bash/moon-maker/.moons/stars.forth.EuFSfOF1.scm deleted file mode 100644 index e69de29..0000000 diff --git a/bash/moon-maker/.moons/stars.forth.H8AC1bT0.txt b/bash/moon-maker/.moons/stars.forth.H8AC1bT0.txt deleted file mode 100644 index e69de29..0000000 diff --git a/bash/moon-maker/.moons/stars.forth.ISg3Mj1s.php b/bash/moon-maker/.moons/stars.forth.ISg3Mj1s.php deleted file mode 100644 index e69de29..0000000 diff --git a/bash/moon-maker/.moons/stars.forth.Sixy2Ac9.php b/bash/moon-maker/.moons/stars.forth.Sixy2Ac9.php deleted file mode 100644 index e69de29..0000000 diff --git a/bash/moon-maker/.moons/stars.forth.V4Syxtq0.cpp b/bash/moon-maker/.moons/stars.forth.V4Syxtq0.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/bash/moon-maker/.moons/stars.forth.YmpYiozi.php b/bash/moon-maker/.moons/stars.forth.YmpYiozi.php deleted file mode 100644 index e69de29..0000000 diff --git a/bash/moon-maker/.moons/stars.forth.gU70oHpV.lisp b/bash/moon-maker/.moons/stars.forth.gU70oHpV.lisp deleted file mode 100644 index e69de29..0000000 diff --git a/bash/moon-maker/.moons/stars.forth.o3rS3aXl.php b/bash/moon-maker/.moons/stars.forth.o3rS3aXl.php deleted file mode 100644 index e69de29..0000000 diff --git a/bash/moon-maker/.moons/stars.forth.rgEcfVrd.cpp b/bash/moon-maker/.moons/stars.forth.rgEcfVrd.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/bash/moon-maker/.moons/stars.fs.0mOZSrc4.txt b/bash/moon-maker/.moons/stars.fs.0mOZSrc4.txt new file mode 100644 index 0000000..e69de29 diff --git a/bash/moon-maker/.moons/stars.fs.c+Brlwde.c b/bash/moon-maker/.moons/stars.fs.c+Brlwde.c new file mode 100644 index 0000000..e69de29 diff --git a/bash/moon-maker/.moons/stars.fs.pZ3G2Et+.txt b/bash/moon-maker/.moons/stars.fs.pZ3G2Et+.txt new file mode 100644 index 0000000..e69de29 diff --git a/bash/moon-maker/.moons/test.c.DjApQF8U.c b/bash/moon-maker/.moons/test.c.DjApQF8U.c deleted file mode 100644 index e69de29..0000000 diff --git a/bash/moon-maker/.moons/test.c.aUnK2SZs.txt b/bash/moon-maker/.moons/test.c.aUnK2SZs.txt deleted file mode 100644 index e69de29..0000000 diff --git a/bash/moon-maker/.moons/test.c.bMU0cW1t.txt b/bash/moon-maker/.moons/test.c.bMU0cW1t.txt deleted file mode 100644 index e69de29..0000000 diff --git a/bash/moon-maker/.moons/test.c.eYBzzwjx.c b/bash/moon-maker/.moons/test.c.eYBzzwjx.c deleted file mode 100644 index e69de29..0000000 diff --git a/bash/moon-maker/.moons/test.c.vUaRvDNg.md b/bash/moon-maker/.moons/test.c.vUaRvDNg.md deleted file mode 100644 index e69de29..0000000 diff --git a/bash/moon-maker/banana/kiwi/mango/strawberry/pineapple/stars.forth b/bash/moon-maker/banana/kiwi/mango/strawberry/pineapple/stars.forth deleted file mode 100644 index ed9b77b..0000000 --- a/bash/moon-maker/banana/kiwi/mango/strawberry/pineapple/stars.forth +++ /dev/null @@ -1,4 +0,0 @@ -: STAR [CHAR] * EMIT ; -: STARS 0 DO STAR LOOP CR ; -10 STARS -BYE \ No newline at end of file diff --git a/bash/moon-maker/banana/kiwi/mango/strawberry/pineapple/stars.fs b/bash/moon-maker/banana/kiwi/mango/strawberry/pineapple/stars.fs new file mode 100644 index 0000000..ed9b77b --- /dev/null +++ b/bash/moon-maker/banana/kiwi/mango/strawberry/pineapple/stars.fs @@ -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 699d542..b008e90 100755 --- a/bash/moon-maker/mm +++ b/bash/moon-maker/mm @@ -26,6 +26,40 @@ add-moons () { fi } +delete-moon-by-moon-id () { + if [[ -d ".moons" ]]; then + rm .moons/*"$1"* + echo -e "The moon $1 has been removed" + else + path=$(pwd) + while [ -n "$path" ]; do + path=${path%/*} + if [ -d "$path/.moons" ]; then + rm "$path/.moons/"*"$1"* + echo -e "The moon $1 has been removed" + return + fi + done + fi +} + +delete-moons-by-planet () { + if [[ -d ".moons" ]]; then + rm .moons/"$1"* + echo -e "All moons orbiting $1 have been deleted." + else + path=$(pwd) + while [ -n "$path" ]; do + path=${path%/*} + if [ -d "$path/.moons" ]; then + rm "$path/.moons/$1"* + echo -e "All moons orbiting $1 have been deleted." + return + fi + done + fi +} + open-moons () { if [[ -d ".moons" ]]; then for file in .moons/$1; do @@ -47,6 +81,38 @@ open-moons () { fi } +list-moons-by-planet () { + if [[ -d ".moons" ]]; then + ls -a .moons/"$1"* + else + path=$(pwd) + while [ -n "$path" ]; do + path=${path%/*} + if [ -d "$path/.moons" ]; then + ls -a "$path/.moons/$1"* + return + fi + done + fi +} + +rename-planet-and-orbiting-moons () { + if [[ -d ".moons" ]]; then + for file in .moons/"$1"* ; do mv "$file" "${file//$1/$2}" ; done + echo -e "Planets and moons have been renamed from $1 to $2" + else + path=$(pwd) + while [ -n "$path" ]; do + path=${path%/*} + if [ -d "$path/.moons" ]; then + for file in "$path/.moons/$1"* ; do mv "$file" "${file//$1/$2}" ; done + echo -e "Planets and moons have been renamed from $1 to $2" + return + fi + done + fi +} + PRE_SHORT_RAND=$(openssl rand -base64 6) SHORT_RAND=${PRE_SHORT_RAND//\//_} @@ -62,6 +128,7 @@ help_text() { usage: ./mm -i(nit)....initialize a directory to store moon files -o(pen)....open a planet file and all of its moon files + -l(ist)....list all moons for a given planet file -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 @@ -91,23 +158,23 @@ elif [[ "${1-}" =~ ^-*a(dd)?$ ]]; then 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 + 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" add-moons "$NEW_MOON" "$2" exit +elif [[ "${1-}" =~ ^-*l(ist)?$ ]]; then + list-moons-by-planet "$2" + exit elif [[ "${1-}" =~ ^-*d(elete)?$ ]]; then - echo "delete" + delete-moon-by-moon-id "$2" exit elif [[ "${1-}" =~ ^-*c(lear)?$ ]]; then - echo "clear" + delete-moons-by-planet "$2" exit elif [[ "${1-}" =~ ^-*u(pdate)?$ ]]; then - echo "update" - exit -elif [[ "${1-}" =~ ^-*z(eplin)?$ ]]; then - echo -e "zeplin" - $EDITOR "$2" + mv "$2" "$3" + rename-planet-and-orbiting-moons "$2" "$3" exit fi diff --git a/bash/moon-maker/plan9.c b/bash/moon-maker/plan9.c new file mode 100644 index 0000000..596f5dc --- /dev/null +++ b/bash/moon-maker/plan9.c @@ -0,0 +1,9 @@ +#include +#include + +void +main(void) +{ + print("hello, world\n"); + exits(0); +} \ No newline at end of file diff --git a/bash/moon-maker/test.c b/bash/moon-maker/test.c deleted file mode 100644 index 596f5dc..0000000 --- a/bash/moon-maker/test.c +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include - -void -main(void) -{ - print("hello, world\n"); - exits(0); -} \ No newline at end of file -- cgit 1.4.1-2-gfad0