« get me outta code hell

more acme - dotfiles - Miscellaneous configuration files of my personal use
about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-10-28 20:15:37 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-10-28 20:15:37 -0300
commit985582b80c83dc894c383b41455973a1f9e7b562 (patch)
treec7f2df1d68e7e7695e715ba0b41579edb0297e2a /scripts
parent2031bd979dc9c27b303e0a53bc0cc9f4f0ef715a (diff)
more acme HEAD main
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/acme/WT3
-rwxr-xr-xscripts/acme/WT+3
-rwxr-xr-xscripts/acme/Wikitag36
-rwxr-xr-xscripts/acme/wikebab24
-rwxr-xr-xscripts/acme/winn3
5 files changed, 69 insertions, 0 deletions
diff --git a/scripts/acme/WT b/scripts/acme/WT
new file mode 100755
index 0000000..1db104d
--- /dev/null
+++ b/scripts/acme/WT
@@ -0,0 +1,3 @@
+#!/bin/zsh
+
+Wikitag </dev/stdin
\ No newline at end of file
diff --git a/scripts/acme/WT+ b/scripts/acme/WT+
new file mode 100755
index 0000000..e52d278
--- /dev/null
+++ b/scripts/acme/WT+
@@ -0,0 +1,3 @@
+#!/bin/zsh
+
+Wikitag -l </dev/stdin
\ No newline at end of file
diff --git a/scripts/acme/Wikitag b/scripts/acme/Wikitag
new file mode 100755
index 0000000..645bf1a
--- /dev/null
+++ b/scripts/acme/Wikitag
@@ -0,0 +1,36 @@
+#!/bin/zsh
+
+while getopts ":l" opt; do; case $opt in
+	l) label=1 ;;
+	*) exit 1
+esac; done
+
+cycle=( artist track album group )
+
+src=$(</dev/stdin)
+
+if [[ ! $src =~ '^\[\[.*\]\]$' ]]; then
+	printf '[[%s]]' "$src"; exit 0
+fi
+
+src=$src:s/[[//:s/]]//
+
+if [[ ! $src =~ '^[^ ]+:' ]]; then
+	if [[ -v label ]];
+	then printf '[[%s:%s|%s]]' ${cycle[1]} $(wikebab <<< "$src") "$src"
+	else printf '[[%s:%s]]' ${cycle[1]} $(wikebab <<< "$src")
+	fi; exit 0
+fi
+
+replacer=${src%:*}
+value=${src#*:}
+
+place=${cycle[(ie)$replacer]}
+length=${#cycle}
+if (( place >= length )); then
+	next=1
+else
+	(( next = place + 1 ))
+fi
+
+printf '[[%s:%s]]' ${cycle[$next]} $value
\ No newline at end of file
diff --git a/scripts/acme/wikebab b/scripts/acme/wikebab
new file mode 100755
index 0000000..3ba5c6e
--- /dev/null
+++ b/scripts/acme/wikebab
@@ -0,0 +1,24 @@
+#!/bin/zsh
+
+# Light version of getKebabCase which skips out on
+# a bunch of things we have no idea how to code with
+# sed regex, but aren't all too important for utility use.
+
+cat /dev/stdin | tr '[:upper:]' '[:lower:]' | sed \
+	-r \
+	-e 's/ /-/g' \
+	-e 's/&/-and-/g' \
+	-e 's/\+/-plus-/g' \
+	-e 's/%/-percent-/g' \
+	-e 's/(\b[^\s.-]{2,})\./$1-/g' \
+	-e 's/\.([^\s.-]{2,})\b/-$1/g' \
+	-e 's/[/@#$%*()_=,[\]{}|\\;:<>?`~]/-/g' \
+	-e 's/[áâäàå]/a/g' \
+	-e 's/[çč]/c/g' \
+	-e 's/[éêëè]/e/g' \
+	-e 's/[íîïì]/i/g' \
+	-e 's/[óôöò]/o/g' \
+	-e 's/[úûüù]/u/g' \
+	-e 's/[^a-z0-9-]//g' \
+	-e 's/-{2,}/-/g' \
+	-e 's/^-+|-+$//g'
\ No newline at end of file
diff --git a/scripts/acme/winn b/scripts/acme/winn
new file mode 100755
index 0000000..9bf7359
--- /dev/null
+++ b/scripts/acme/winn
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+cd "$1" && win "$SHELL"