1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2025-06-14 08:41:43 +00:00

Standardized error messages.

This commit is contained in:
Sorin Ionescu
2012-01-19 02:28:01 -05:00
parent 28da8f916b
commit 95c29bada8
10 changed files with 33 additions and 29 deletions

View File

@ -1,12 +1,14 @@
local verbose
if (( $# == 0 )); then
print "Usage: extract [-option] [file ...]"
print
print "Options:"
print " -v, --verbose Verbose archive listing."
print
print "Report bugs to <sorin.ionescu@gmail.com>."
cat >&2 <<EOF
usage: $0 [-option] [file ...]
options:
-v, --verbose verbose archive listing
Report bugs to <sorin.ionescu@gmail.com>.
EOF
fi
if [[ "$1" == "-v" ]] || [[ "$1" == "--verbose" ]]; then
@ -16,7 +18,7 @@ fi
while (( $# > 0 )); do
if [[ ! -f "$1" ]]; then
print "extract: '$1' is not a valid file" 1>&2
print "$0: file not valid: $1" >&2
shift
continue
fi
@ -35,7 +37,7 @@ while (( $# > 0 )); do
(*.rar) unrar ${${verbose:+v}:-l} "$1" ;;
(*.7z) 7za l "$1" ;;
(*)
print "ls-archive: '$1' cannot be listed" 1>&2
print "$0: cannot list: $1" >&2
success=1
;;
esac