aboutsummaryrefslogtreecommitdiff
path: root/contrib/kiss-cargolock-urlgen
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-04-20 18:11:43 +0000
committermerakor <cem@ckyln.com>2020-04-20 18:11:43 +0000
commit7a4fcf554c75c5f73bf51f840e72ba7fbedb7e60 (patch)
tree4e0c47c6a2d14295a7f48553793d11008fed24cc /contrib/kiss-cargolock-urlgen
parent395d0f1a6019c176de72ce3aa30f57eb810b0d9b (diff)
downloadcpt-7a4fcf554c75c5f73bf51f840e72ba7fbedb7e60.tar.gz
contrib: additions, usage, simplifications
FossilOrigin-Name: 8d7d95914b0d1d981416c4fe1511987af3dd0170d436ee2176de9cb279988dd0
Diffstat (limited to 'contrib/kiss-cargolock-urlgen')
-rwxr-xr-xcontrib/kiss-cargolock-urlgen9
1 files changed, 5 insertions, 4 deletions
diff --git a/contrib/kiss-cargolock-urlgen b/contrib/kiss-cargolock-urlgen
index a67b374..f9f377a 100755
--- a/contrib/kiss-cargolock-urlgen
+++ b/contrib/kiss-cargolock-urlgen
@@ -2,10 +2,11 @@
# Converts the given Cargo.lock file to static cargo urls
-[ -r "$1" ] || {
- printf 'usage: %s <Cargo.lock file>\n' "${0##*/}"
- exit 1
-}
+case "$1" in
+ -) set -- /dev/stdin ;;
+ '') printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} <Cargo.lock file>" "" \
+ "'-' can be used to read from stdin." ; exit 0
+esac
# Word splitting is intentional
# shellcheck disable=2046