diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2025-01-05 19:48:25 +0100 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2025-01-05 19:48:25 +0100 |
commit | 58bf86c706c5a442da4fb01ea26e06f1ed291d45 (patch) | |
tree | fbf807aae15c4f3eb467f1475f2329c8709d0e24 /bin/extra | |
parent | 0a69f01a5f7f67bd771fd983aa8ba4146cbafcc8 (diff) |
checkpoint
Diffstat (limited to 'bin/extra')
-rwxr-xr-x | bin/extra/gdbcore | 13 | ||||
-rwxr-xr-x | bin/extra/p.sh | 10 |
2 files changed, 16 insertions, 7 deletions
diff --git a/bin/extra/gdbcore b/bin/extra/gdbcore index 667db3e..6daafa8 100755 --- a/bin/extra/gdbcore +++ b/bin/extra/gdbcore @@ -1,6 +1,7 @@ #!/bin/sh -# Open the latest core file for program with gdb +# Open the latest core file for program $1 with gdb +# If no program supplied then use the most recent one # RETURN VALUES # 0 - success # 1 - if the program was not found or not executable @@ -8,6 +9,8 @@ # 3 - zstd failed # 4 - wrong usage +cache="$HOME/.cache/gdbcore_prog" + if [ "$#" -lt 1 ]; then >&2 printf 'usage: gdbcore [-r] <program>\n' fi @@ -17,7 +20,13 @@ if [ "$1" = "-r" ]; then shift fi -prog="$1" +if [ "$1" ]; then + prog="$1" + printf '%s\n' "$prog" > "$cache" +else + prog="$(cat "$cache")" +fi + if [ ! -x "$prog" ]; then prog="$(which "$prog" 2>/dev/null)" [ -x "$prog" ] || exit 1 diff --git a/bin/extra/p.sh b/bin/extra/p.sh index 98f8ede..e33f5ba 100755 --- a/bin/extra/p.sh +++ b/bin/extra/p.sh @@ -661,14 +661,17 @@ html="/tmp/pk_tmp.html" [ "$pokemon" ] || pokemon="$(ask_pokemon)" [ "$pokemon" ] || exit 1 -case "$1" in +choice="$(printf 'evolution\nmoves\nstats\n' | commander -c -w 3)" +[ "$choice" ] || exit 1 + +case "$choice" in # evolution e*) url="https://pokemondb.net/pokedex/$pokemon" curl -Ls "$url" > "$html" level1="$(pup -p 'span.infocard:nth-child(2) > small:nth-child(2) text{}' < "$html")" level2="$(pup -p 'span.infocard:nth-child(4) > small:nth-child(2) text{}' < "$html")" - notify-send "p.sh" "$level1\n$level2" + herbe "p.sh" "$level1" "$level2" & ;; # moves @@ -676,7 +679,4 @@ case "$1" in # stats s*) $BROWSER "https://www.smogon.com/dex/bw/pokemon/$pokemon/" ;; - *) - choice="$(printf 'evolution\nmoves\nstats\n' | commander -c -w 3)" - [ "$choice" ] && pokemon="$pokemon" $0 "$choice" ;; esac |