diff options
| -rw-r--r-- | .zshrc | 2 | ||||
| -rwxr-xr-x | device/acme_pre | 12 | ||||
| -rwxr-xr-x | scripts/acme/WT | 3 | ||||
| -rwxr-xr-x | scripts/acme/WT+ | 3 | ||||
| -rwxr-xr-x | scripts/acme/Wikitag | 36 | ||||
| -rwxr-xr-x | scripts/acme/wikebab | 24 | ||||
| -rwxr-xr-x | scripts/acme/winn | 3 |
7 files changed, 81 insertions, 2 deletions
diff --git a/.zshrc b/.zshrc index 14c2b54..97d0ddf 100644 --- a/.zshrc +++ b/.zshrc @@ -105,7 +105,7 @@ if [[ -v DEVICE_HAS_PLAN9 ]]; then plumber 2>/dev/null - alias acme='SHELL="'"$DOTFILES"'"/scripts/acme/acme-shell acme' + alias acme='SHELL="'"$DOTFILES"'"/scripts/acme/acme-shell PATH="'"$DOTFILES"'/scripts/acme:$PATH" acme' fi # -- Python -- diff --git a/device/acme_pre b/device/acme_pre index d679ed9..5dd6e31 100755 --- a/device/acme_pre +++ b/device/acme_pre @@ -6,7 +6,10 @@ # to use. This is treated like a device of its own, even # though it really isn't. +awd zsh + export EDITOR=E +export NO_COLOR=1 path=("$DOTFILES/scripts/acme" "$DOTFILES/scripts/acme_dynamic" $path) export PATH @@ -19,5 +22,12 @@ export PATH # ln -s "$(which pinentry-tty)" "$DOTFILES/scripts/acme_dynamic/pinentry" # fi -alias git='git --no-pager' +cd() { + if [ $# -eq 0 ] + then builtin cd && awd zsh + else builtin cd "$1" && awd zsh + fi +} + +alias git='git -c color.ui=false --no-pager' alias ls='ls -1' 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" |