aboutsummaryrefslogtreecommitdiff
path: root/bin/tl
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-09-03 13:31:15 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-09-03 13:31:15 +1200
commit465e4e7abaf52b485d484a8213556efba413c50b (patch)
treecf1dc49a4d31800b85f6afe0133784e765f3d030 /bin/tl
parentSimplify cfr(1) with new -o option to cf(1) (diff)
downloaddotfiles-465e4e7abaf52b485d484a8213556efba413c50b.tar.gz
dotfiles-465e4e7abaf52b485d484a8213556efba413c50b.zip
Tidy/correct tl(1) option parsing
Diffstat (limited to 'bin/tl')
-rwxr-xr-xbin/tl22
1 files changed, 13 insertions, 9 deletions
diff --git a/bin/tl b/bin/tl
index 5d494f5a..baa6fb2b 100755
--- a/bin/tl
+++ b/bin/tl
@@ -1,17 +1,21 @@
#!/bin/sh
-# Tag lines from files or stdin with a string prefix or suffix.
+# Tag lines from files or stdin with a string prefix or suffix
+self=tl
-# Parse options out, give help if necessary
+# Parse options out
while getopts 'p:s:' opt ; do
case $opt in
- p)
- pref=$OPTARG
- ;;
- s)
- suff=$OPTARG
- ;;
+
+ # Prefix
+ p) pref=$OPTARG ;;
+
+ # Suffix
+ s) suff=$OPTARG ;;
+
+ # Unknown option
\?)
- usage >&2
+ printf >&2 '%s: Unknown option %s\n' \
+ "$self" "$opt"
exit 2
;;
esac