mirror of
https://github.com/dcarrillo/prezto.git
synced 2025-06-14 19:31:43 +00:00
Standardized error messages.
This commit is contained in:
@ -4,12 +4,14 @@ local file_name
|
||||
local extract_dir
|
||||
|
||||
if (( $# == 0 )); then
|
||||
print "Usage: extract [-option] [file ...]"
|
||||
print
|
||||
print "Options:"
|
||||
print " -r, --remove Remove archive."
|
||||
print
|
||||
print "Report bugs to <sorin.ionescu@gmail.com>."
|
||||
cat >&2 <<EOF
|
||||
usage: $0 [-option] [file ...]
|
||||
|
||||
options:
|
||||
-r, --remove remove archive
|
||||
|
||||
Report bugs to <sorin.ionescu@gmail.com>.
|
||||
EOF
|
||||
fi
|
||||
|
||||
remove_archive=1
|
||||
@ -20,7 +22,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
|
||||
@ -56,7 +58,7 @@ while (( $# > 0 )); do
|
||||
cd ..
|
||||
;;
|
||||
(*)
|
||||
print "extract: '$1' cannot be extracted" 1>&2
|
||||
print "$0: cannot extract: $1" >&2
|
||||
success=1
|
||||
;;
|
||||
esac
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user