diff options
| author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-10-04 02:40:50 +0200 | 
|---|---|---|
| committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-10-04 02:44:17 +0200 | 
| commit | 5a8c1637d56e430f6d80e2b27e28f31cf21687dd (patch) | |
| tree | 6d3994c07ffeccc068e9f872dc72e955ffbfb82c | |
| parent | 010c7903562963e5585190896f47d62218fa08fd (diff) | |
added reading from stdin
| -rwxr-xr-x | bin/extra/supd | 17 | 
1 files changed, 14 insertions, 3 deletions
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 <prefix> <dir>"; exit 1; } +usage() { +	>&2 cat <<-EOF +	usage: supd +	       supd <prefix> <dir> +		   stdout | supd <prefix> +	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  | 
