* [PATCH] _net_interfaces: enable completion for mappings on debian systems
@ 2008-01-21 23:58 Sepp Steiner
2008-01-22 9:53 ` Oliver Kiddle
0 siblings, 1 reply; 4+ messages in thread
From: Sepp Steiner @ 2008-01-21 23:58 UTC (permalink / raw)
To: zsh-workers
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.
The first part of the patch avoids use of sed, when filling ${intf}.
The second part contains the patch to enable completion for mappings and
corrections of ifdown.
1. ifdown: If we call completion for ifdown look in
/etc/network/run/ifstate and list the registered interfaces
2. ifup: My patch tries to dedect, if you use mappings. If you do use
them, then my _net_interfaces completion lists all cominations
of interfaces and mappings, excluding the loopback interface.
In any other case it acts in the same way as the actual
completion.
eg. - ifconfig -a lists eth0 and lo. Both of them are in
/etc/network/interfaces -> Behavior as known
- ifconfig -a lists eth0 and lo, but only one or none of them is
listed in /etc/network/interfaces and no other mapping is used
-> Behavior as known
- ifconfig -a lists eth0 and lo. /etc/network/interfaces contains
one, none or both of them, but also other mappings ->
Completion lists all possible compinations of interfaces and
mappings excluding the loopback interface.
I tested this patch with zsh 4.3.4-dev-7 on debian unstable.
Excuse me for only posting a link but i use gmane and slrn to poste this
patch and it seems that slrn is not capable of attaching files.
http://members.inode.at/sepp.steiner/test/_net_interfaces.patch
Regards,
Sepp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] _net_interfaces: enable completion for mappings on debian systems
2008-01-21 23:58 [PATCH] _net_interfaces: enable completion for mappings on debian systems Sepp Steiner
@ 2008-01-22 9:53 ` Oliver Kiddle
2008-01-22 15:17 ` Bart Schaefer
2008-01-22 16:38 ` [ PATCH ] _net_interfaces: debian specific rewrite was: " Sepp Steiner
0 siblings, 2 replies; 4+ messages in thread
From: Oliver Kiddle @ 2008-01-22 9:53 UTC (permalink / raw)
To: Sepp Steiner; +Cc: zsh-workers
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] _net_interfaces: enable completion for mappings on debian systems
2008-01-22 9:53 ` Oliver Kiddle
@ 2008-01-22 15:17 ` Bart Schaefer
2008-01-22 16:38 ` [ PATCH ] _net_interfaces: debian specific rewrite was: " Sepp Steiner
1 sibling, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2008-01-22 15:17 UTC (permalink / raw)
To: zsh-workers
On Jan 22, 10:53am, Oliver Kiddle wrote:
}
} 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.
The commands ifup and ifdown aren't specific to Debian, although the
set of completions for ifup might be in this instance.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ PATCH ] _net_interfaces: debian specific rewrite was: Re: [PATCH] _net_interfaces: enable completion for mappings on debian systems
2008-01-22 9:53 ` Oliver Kiddle
2008-01-22 15:17 ` Bart Schaefer
@ 2008-01-22 16:38 ` Sepp Steiner
1 sibling, 0 replies; 4+ messages in thread
From: Sepp Steiner @ 2008-01-22 16:38 UTC (permalink / raw)
To: zsh-workers
* Oliver Kiddle wrote:
> 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.
Ifup and ifdown are not specific to debian, but I have done a rewrite of
this patch, to extend the behavior of ifup to show only interfaces and
mappings that are down ans it uses better syntax for comparison of
arrays. Behavior is the same in any other situation is the same as in
the old one.
http://members.inode.at/sepp.steiner/test/_net_interfaces.patch_debiancompl_v2
Sepp
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-01-22 16:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-21 23:58 [PATCH] _net_interfaces: enable completion for mappings on debian systems Sepp Steiner
2008-01-22 9:53 ` Oliver Kiddle
2008-01-22 15:17 ` Bart Schaefer
2008-01-22 16:38 ` [ PATCH ] _net_interfaces: debian specific rewrite was: " Sepp Steiner
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).