On Mon, Jan 03, 2022 at 08:12:50PM +0000, Long Wind wrote:
> Thank Greg!  i use bash 5.0-4 and bash-completion 1:2.8-6

> i type "ifdown wl" and press Tab, nothing happens
> there's only one wireless device in /etc/network/interfaces
> it shall complete command to "ifdown wlx12345" 
> 
> i've read /etc/skel/.bashrc, programmable completion seems enabled by default
> and it works for other commands, e.g. i type "dhclient enp" and Tab, it 
> becomes "dhclient enp0s1" 

Well.  In this package, the completions for ifdown and dhclient
are very different.  E.g. in dhclient's completion, there's code that
looks like this:

    if [[ "$cur" == -* ]]; then
        COMPREPLY=( $( compgen -W '-p -d -q -1 -r -lf -pf -cf -sf -s -g -n -nw
            -w' -- "$cur" ) )
    else
        _available_interfaces

The ifdown completion, on the other hand, has:

    if [[ $cword -eq 1 ]]; then
        _configured_interfaces
        COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") )

I wonder what the difference between _available_interfaces and
_configured_interfaces is.  Looks important.

Reply via email to