diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2017-09-25 15:09:31 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2017-09-25 15:09:31 -0400 |
commit | f446f62eb968ba9479abcd1d2b00794340e78153 (patch) | |
tree | 431c6c5f13dadf62f7fc19ea6c7f09178dc912bd | |
parent | 4c04b4de8266caf326d8915f129d42e3e83e0575 (diff) |
chardiff: Better help text
-rw-r--r-- | chardiff.sh | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/chardiff.sh b/chardiff.sh index 6d629d2..4256d0c 100644 --- a/chardiff.sh +++ b/chardiff.sh @@ -32,6 +32,8 @@ wdiff_getopt() { eval set -- "$args" while true; do case "$1" in + -C|--copyright|-h|--help|-v|--version) + printf -- '%s' "$1"; return;; --) shift; break;; *) shift;; esac @@ -51,9 +53,31 @@ wdiff_getopt() { main() { # Normalize the arguments declare flags - flags="$(wdiff_getopt "$@")" || { wdiff --help >&2; return 1; } + if ! flags="$(wdiff_getopt "$@")"; then + printf "$(gettext 'Try `%s'\'' for my information.\n')" "${0##*/} --help" >&2 + return 2 + fi eval set -- "$flags" + case "$1" in + -C|--copyright) + wdiff --copyright + return + ;; + -h|--help) + printf "$(gettext 'chardiff - Compares characters in two files and report differences.\n')" + wdiff --help | sed -e 1d -e '/\s-d\b/d' -e /diff-input/d -e '/@gnu\.org/d' -e "s/wdiff/${0##*/}/g" + printf "$(gettext 'Report bugs to <lukeshu@lukeshu.com>.\n')" + return 0 + ;; + -v|--version) + printf "$(gettext 'chardiff (thingutils chardiff) %s\n')" 0 + printf "$(gettext 'Using:\n')" + wdiff --version + return 0 + ;; + esac + # Run wdiff with our filters declare -a args=("$@") declare file2=${args[-1]}; unset args[-1] |