From 5a8c1637d56e430f6d80e2b27e28f31cf21687dd Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Wed, 4 Oct 2023 02:40:50 +0200 Subject: added reading from stdin --- bin/extra/supd | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/extra/supd b/bin/extra/supd index a383d65..83a606b 100755 --- a/bin/extra/supd +++ b/bin/extra/supd @@ -1,6 +1,13 @@ #!/bin/sh -usage() { >&2 printf "usage: supd\nusage: supd "; exit 1; } +usage() { + >&2 cat <<-EOF + usage: supd + supd + stdout | supd + EOF + exit 1 +} check () { @@ -12,8 +19,8 @@ check () printf 'Up to date.' || printf 'Couldn'\''t update.' printf ' ' - git status --short 2> /dev/null | head -n1 | awk '{print $1 " "}' - printf '\n' + printf '%s\n' "$(git status --short 2> /dev/null | + awk 'NR==1 {print $1}')" done } @@ -21,6 +28,10 @@ if [ "$#" -eq 0 ] then dirs="installdrier dotfiles password-store" prefix="$HOME/src" +elif [ ! -t 0 ] +then + prefix="$1" + dirs="$(cat)" else prefix="$1" shift || usage -- cgit v1.2.3