1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-09 00:11:25 +02:00

Fix zrecompile.

This commit is contained in:
Bart Schaefer 2000-09-03 22:14:26 +00:00
parent 6dd5fc9cef
commit f23e444392
2 changed files with 27 additions and 10 deletions

View file

@ -3,6 +3,11 @@
* 12728: Completion/User/_man: complete _files instead of * 12728: Completion/User/_man: complete _files instead of
manpages if -l or --local-file is present on the commandline. manpages if -l or --local-file is present on the commandline.
2000-09-03 Bart Schaefer <schaefer@zsh.org>
* 12726,12727: Functions/Misc/zrecompile: Handle pass-through of
all zcompile options.
2000-09-02 Bart Schaefer <schaefer@zsh.org> 2000-09-02 Bart Schaefer <schaefer@zsh.org>
* 12725: Util/helpfiles: Recognize more end-of-page patterns, and * 12725: Util/helpfiles: Recognize more end-of-page patterns, and

View file

@ -33,18 +33,26 @@
# that needed re-compilation could be compiled and non-zero if compilation # that needed re-compilation could be compiled and non-zero if compilation
# for at least one of the files failed. # for at least one of the files failed.
setopt localoptions extendedglob setopt localoptions extendedglob noshwordsplit noksharrays
local opt check quiet zwc files re file pre ret map tmp mesg pats local opt check quiet zwc files re file pre ret map tmp mesg pats
while getopts "tqp" opt; do tmp=()
while getopts ":tqp" opt; do
case $opt in case $opt in
t) check=yes ;; t) check=yes ;;
q) quiet=yes ;; q) quiet=yes ;;
p) pats=yes ;; p) pats=yes ;;
*)
if [[ -n $pats ]]; then
tmp=( $tmp $OPTARG )
else
print -u2 zrecompile: bad option: -$OPTARG
return 1
fi
esac esac
done done
shift OPTIND-1 shift OPTIND-${#tmp:-1}
if [[ -n $check ]]; then if [[ -n $check ]]; then
ret=1 ret=1
@ -66,12 +74,16 @@ if [[ -n $pats ]]; then
argv=() argv=()
fi fi
if [[ $files[1] = -[RM] ]]; then tmp=()
map=( $files[1] )
shift 1 files
else
map=() map=()
fi OPTIND=1
while getopts :MR opt $files; do
case $opt in
[MR]) map=( -$opt ) ;;
*) tmp=( $tmp $files[OPTIND] );;
esac
done
shift OPTIND-1 files
(( $#files )) || continue (( $#files )) || continue
files=( $files[1] ${files[2,-1]:#*(.zwc|~)} ) files=( $files[1] ${files[2,-1]:#*(.zwc|~)} )
@ -117,7 +129,7 @@ if [[ -n $pats ]]; then
# old file by renaming it. # old file by renaming it.
if { [[ ! -f $zwc ]] || mv $zwc ${zwc}.old } && if { [[ ! -f $zwc ]] || mv $zwc ${zwc}.old } &&
zcompile "$map[@]" $zwc $files 2> /dev/null; then zcompile $map $tmp $zwc $files 2> /dev/null; then
[[ -z $quiet ]] && print succeeded [[ -z $quiet ]] && print succeeded
else else
[[ -z $quiet ]] && print failed [[ -z $quiet ]] && print failed