Signed-off-by: Gordian Edenhofer <gordian.edenhofer@gmail.com> --- contrib/pacdiff.sh.in | 67 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 25 deletions(-) diff --git a/contrib/pacdiff.sh.in b/contrib/pacdiff.sh.in index 3394993..b9b15b8 100644 --- a/contrib/pacdiff.sh.in +++ b/contrib/pacdiff.sh.in @@ -29,35 +29,52 @@ USE_COLOR='y' declare -a oldsaves declare -i USE_FIND=0 USE_LOCATE=0 USE_PACDB=0 OUTPUTONLY=0 +# gettext initialization +export TEXTDOMAIN='pacman' +export TEXTDOMAINDIR='@localedir@' + +# Determine whether we have gettext; make it a no-op if we do not +if ! type -p gettext >/dev/null; then + gettext() { + printf "%s\n" "$@" + } +fi + m4_include(../scripts/library/output_format.sh) m4_include(../scripts/library/parseopts.sh) usage() { - cat <<EOF -${myname} (pacman) v${myver} - -A simple program to merge or remove pacnew/pacsave files. - -Usage: $myname [-l | -f | -p] [--nocolor] - -Search Options: select one (default: --pacmandb) - -l/--locate scan using locate - -f/--find scan using find - -p/--pacmandb scan active config files from pacman database - -General Options: - -o/--output print files instead of merging them - -m/--nocolor remove colors from output - -Environment Variables: - DIFFPROG override the merge program: (default: 'vim -d') - DIFFSEARCHPATH override the search path. (only when using find) - (default: /etc) - -Example: DIFFPROG=meld DIFFSEARCHPATH="/boot /etc /usr" $myname -Example: $myname --output --locate - -EOF + printf "%s (pacman) %s\n" "$myname" "$myver" + echo + printf -- "$(gettext "A simple program to merge or remove pacnew/pacsave files")\n" + echo + printf -- "$(gettext "Usage: %s <operation> [options]")\n" "$0" + echo + printf -- "$(gettext "Search Options:")\n" + printf -- " -l, --locate " + printf -- "$(gettext "Scan using locate")\n" + printf -- " -f, --find " + printf -- "$(gettext "Scan using find")\n" + printf -- " -p, --pacmandb " + printf -- "$(gettext "Scan active config files from pacman database")\n" + echo + printf -- "$(gettext "Options:")\n" + printf -- " -o, --output " + printf -- "$(gettext "Print files instead of merging them")\n" + printf -- " -m, --nocolor " + printf -- "$(gettext "Remove colors from output")\n" + echo + printf -- "$(gettext "Environment Variables:")\n" + printf -- " DIFFPROG " + printf -- "$(gettext "Override the merge program: (default: '%s')")\n" "vim -d" + printf -- " DIFFSEARCHPATH " + printf -- "$(gettext "Override the search path. (only when using find)\n\ + (default: %s)")\n" "/etc" + echo + printf -- "$(gettext "Examples:")" + printf -- " DIFFPROG=meld DIFFSEARCHPATH=\"/boot /etc /usr\" %s\n" "$myname" + printf -- " %s --output --locate\n" "$myname" + echo } version() { -- 2.10.0