From 15199938dca3741df3a7f30100c847bb89abe256 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Sat, 3 Sep 2022 13:37:33 +0200 Subject: [PATCH] bin: update sshl and arg-test --- .config/shell/functions | 5 +++-- .local/bin/scripts/arg-test | 9 ++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.config/shell/functions b/.config/shell/functions index bb95427..27bddc1 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -269,7 +269,7 @@ dns() { drill AAAA @8.8.8.8 -Q "${arg##*/}" done } -alias sshk='kitty +kitten ssh' +alias sshk="$(case $TERM in (*-kitty) echo 'kitty +kitten';; esac) ssh" sshl() { test "$1" = "-a" && shift && local all=true lemonade server -allow 127.0.0.1 & @@ -286,7 +286,8 @@ sshl() { cut -d " " -f2- | sed "s|^~|$HOME|")" "$1" && touch "$file" - $(case $TERM in (*-kitty) echo 'kitty +kitten';; esac) ssh -R 2489:127.0.0.1:2489 "$@" + #TERM=xterm-256color + sshk -R 2489:127.0.0.1:2489 "$@" fi } diff --git a/.local/bin/scripts/arg-test b/.local/bin/scripts/arg-test index 79977b4..8cf7324 100755 --- a/.local/bin/scripts/arg-test +++ b/.local/bin/scripts/arg-test @@ -1,8 +1,15 @@ #!/bin/sh +outfile=/tmp/args$(date +%s) +# echo "dot - graphviz version 5.0.1 (0)" >&2 { echo "$# Args: ${@:-DEFAULT}" #echo "Starred: $*" #echo "${@:-default}" | sed 's/\w\+/\0-w/g' for last; do true; done echo "Last arg: $last" -} | tee /tmp/args$(date +%s) +} | tee "$outfile" + +if tty -s || test "$1" = "-V" +then echo "Not reading from stdin" +else tee "$outfile-stdin" +fi