[Bash-completion-devel] wget(1) completion

Ville Skyttä ville.skytta at iki.fi
Wed Dec 7 18:43:40 UTC 2011


On 12/04/2011 08:49 PM, Raphaël Droz wrote:
> back with this one
> [ http://lists.alioth.debian.org/pipermail/bash-completion-devel/2009-March/001088.html ]

Some quick comments, not actually tested:

>    [[ $cur =~ (unix|windows), ]] && excludes=( windows unix )
>    [[ $cur =~ (low|upp)ercase, ]] && excludes+=( lowercase uppercase )
>    [ ... etc similar unnecessary =~ cases here and there ... ]

Plain == with @(...) instead of regexp should work for these -- it's
faster and cleaner when considering the case that the above should
probably match the entire $cur exactly, not just a substring (the regexp
version would need anchoring).  Actually I suggest using a case block
(with "non-fancy" labels, see below) for the above particular case
instead of doing redundant regexp tests when we know only one of them
can match.

> -D|-@(bind-address|@(exclude-|)domains))

See "Globbing in case labels" in style guide for this and several other
similar cases.

>        --@(local|remote)-encoding)
>        : # TODO
>        ;;
>        --execute)
>        : # TODO: base=STR
>        ;;

I suppose these should do a "return" instead of a ":".

> --header)

I'm not convinced that offering HTTP header names after this is useful
as it's not only header names that are required, but "Header: value"
strings.

> [ Big case $prev block ]

"$split && return" missing after the block.

> [ The last case $cur block ]

Looks like this could be combined to just one "if [[ $cur == -* ]]".  At
least for me, _parse_help returns only long options.



More information about the Bash-completion-devel mailing list