mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-11 13:01:28 +02:00
36993: zed: fix argument parsing
This commit is contained in:
parent
682e779a21
commit
607a7a85b6
2 changed files with 14 additions and 21 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2015-10-31 Oliver Kiddle <opk@zsh.org>
|
||||||
|
|
||||||
|
* 36993: Eric Cook: Functions/Misc/zed: fix argument parsing
|
||||||
|
|
||||||
2015-10-31 Barton E. Schaefer <schaefer@zsh.org>
|
2015-10-31 Barton E. Schaefer <schaefer@zsh.org>
|
||||||
|
|
||||||
* unposted (cf. 36998,36999): Src/mem.c: undo 36956 / restore 34451
|
* unposted (cf. 36998,36999): Src/mem.c: undo 36956 / restore 34451
|
||||||
|
|
|
@ -6,31 +6,20 @@
|
||||||
# Use ^X^W to save, ^C to abort.
|
# Use ^X^W to save, ^C to abort.
|
||||||
# Option -f: edit shell functions. (Also if called as fned.)
|
# Option -f: edit shell functions. (Also if called as fned.)
|
||||||
|
|
||||||
local var opt zed_file_name
|
local var opts zed_file_name
|
||||||
# We do not want timeout while we are editing a file
|
# We do not want timeout while we are editing a file
|
||||||
integer TMOUT=0 okargs=1 fun bind
|
integer TMOUT=0 okargs=1 fun bind
|
||||||
local -a expand
|
local -a expand
|
||||||
|
|
||||||
while getopts "fbx:" opt; do
|
zparseopts -D -A opts f b x:
|
||||||
case $opt in
|
fun=$+opts[-f]
|
||||||
(f)
|
bind=$+opts[-b]
|
||||||
fun=1
|
if [[ $opts[-x] == <-> ]]; then
|
||||||
;;
|
expand=(-x $opts[-x])
|
||||||
|
elif (( $+opts[-x] )); then
|
||||||
(b)
|
print -r "Integer expected after -x: $opts[-x]" >&2
|
||||||
bind=1
|
|
||||||
;;
|
|
||||||
|
|
||||||
(x)
|
|
||||||
if [[ $OPTARG != <-> ]]; then
|
|
||||||
print -r "Integer expected after -x: $OPTARG" >&2
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
expand=(-x $OPTARG)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
shift $(( OPTIND - 1 ))
|
|
||||||
|
|
||||||
[[ $0 = fned ]] && fun=1
|
[[ $0 = fned ]] && fun=1
|
||||||
(( bind )) && okargs=0
|
(( bind )) && okargs=0
|
||||||
|
|
Loading…
Reference in a new issue