~hedy/dotfiles

a51b14d61c2458891343485f18ffc8a3a3b0a2a9 — hedy 6 months ago 2792125
Scripts: Add a few old scripts that I forgot to track

Acme is an amazing editor btw!
4 files changed, 42 insertions(+), 0 deletions(-)

A bin/emacs-uri-handler.scpt
A bin/gotagacme
A bin/gotagclean.py
A bin/stupidrmdir
A bin/emacs-uri-handler.scpt => bin/emacs-uri-handler.scpt +5 -0
@@ 0,0 1,5 @@
on open location this_URL
	set thefile to (text 9 thru (count this_URL) of this_URL)
	do shell script "/usr/local/bin/emacsclient -c " & thefile
	return
end open location

A bin/gotagacme => bin/gotagacme +4 -0
@@ 0,0 1,4 @@
#!/usr/bin/env bash

read -p "name (without .go)>> " name
gotags "$name".go > tags && ~/bin/gotagclean.py tags > "$name".tags && rm tags

A bin/gotagclean.py => bin/gotagclean.py +22 -0
@@ 0,0 1,22 @@
#!/usr/bin/env python3

import sys

file = sys.argv[1]

with open(file) as f:
    for line in f.readlines():
        if line.startswith("!"):
            continue
        first, file, li, *rest = line.split()
        if rest[0] == "i":
            continue
        newrest = []
        for i in range(1, len(rest)):
            r = rest[i]
            if r.startswith("line"):
                continue
            r = r.removeprefix("access:")
            r = r.removeprefix("signature:")
            newrest.append(r)
        print(f"{first:<12}" + " " + f"{file}:"+li[:-2] + "\t" + "\t".join(newrest))

A bin/stupidrmdir => bin/stupidrmdir +11 -0
@@ 0,0 1,11 @@
#!/usr/bin/env bash

dir="$1"

if [[ -z "$dir" ]]; then
    echo "Usage: stupidrmdir [ dir ]"
    echo "Ensure CWD is what you want!"
fi

echo mv "$dir"/** ./ '&&' rm -r "$dir"
mv "$dir"/** ./ && rm -r "$dir"