Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: device cannot be completed after "ip link show dev"



On Apr 2,  4:03pm, Han Pingtian wrote:
}
} > subcmd_dev=(
} >  /$'[[:alnum:][:punct:][:cntrl:][:digit:]]##\0'/
} >  -'[[ $words[CURRENT-1] != dev ]]'
} >  ':interfaces:network interface:_net_interfaces'
} > )
} 
} If using -'[[ $words[2,CURRENT-1] != *dev* ]]', then "dev" and "up"
} won't be completed after dev (this is right, dev after dev is wrong
} syntax), but there is a prase failed warning :
} 
} % ip link show dev em1 <tab>
} parse failed before current word

Indeed, what we actually want for the guard would appear to be that the
string "dev" does not appear *or* that an actual device name already
appears somewhere *after* "dev".

We're wandering into "is the result worth the effort?" territory, so it
may be that $words[CURRENT-1] is the best compromise.



Messages sorted by: Reverse Date, Date, Thread, Author