summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chardiff.sh26
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]