diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-09-03 13:31:15 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-09-03 13:31:15 +1200 |
commit | 465e4e7abaf52b485d484a8213556efba413c50b (patch) | |
tree | cf1dc49a4d31800b85f6afe0133784e765f3d030 /bin/tl | |
parent | Simplify cfr(1) with new -o option to cf(1) (diff) | |
download | dotfiles-465e4e7abaf52b485d484a8213556efba413c50b.tar.gz dotfiles-465e4e7abaf52b485d484a8213556efba413c50b.zip |
Tidy/correct tl(1) option parsing
Diffstat (limited to 'bin/tl')
-rwxr-xr-x | bin/tl | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -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 |