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

Re: [PATCH] _net_interfaces: enable completion for mappings on debian systems



Sepp Steiner wrote:
> The main part of this patch enables completion of mappings for ifup on 
> debian systems and for ifdown the completion lists only interfaces that 
> are really up and running.

This looks useful. Limiting matches is always good. However, it doesn't
seem right to me that _net_interfaces, which completes network interfaces
in general, should have specific knowledge of ifup and ifdown - Debian
specific commands.

What would be good would be if _net_interfaces took an option to limit
that state of the interfaces it completes. You'd need to find a suitable
option letter that doesn't clash with a completion option (so -s for
state is out because it is used for suffixes). ifup and ifdown would
need their own completion function but it'd be as simple as something
like the following:

case $service in
  (ifup) _net_interfaces -n down;;
  (ifdown) _net_interfaces -n up;;
esac

This would also have the advantage that completion of network interfaces
elsewhere could then be limited to interfaces that are up or down.

Oliver



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