[Bash-completion-devel] [PATCH] Add completion scripts for fcoe-utils and open-lldp

Ville Skyttä ville.skytta at iki.fi
Mon Apr 25 08:41:59 UTC 2011


Hello Robert,

On 04/21/2011 12:19 AM, Robert Love wrote:
> This patch adds completion scripts for fcoeadm, fcoemon,
> lldpad and lldptool. They are very simple scripts, but
> do the trick. A shortcoming of the lldptool completion
> script is that it does not differentiate between options
> and commands.

As you seem to be involved with development of these tools upstream,
have you considered including and installing the completions in your
upstream tarballs?

I'm not at all saying these files cannot be included with
bash-completion, but the big benefit of including them upstream would be
that the completions would be easier to keep in sync with the
corresponding tools' options for the version of them that is installed
given that the options are hardwired in completions and not
parsed/autogenerated - if we include them in bash-completion, chances
are that we'll at some point present options that the installed tools
don't have, or we don't have completions for all options that the
installed tools have, depending on the version of bash-completion and
the upstream tools installed, and it depends on what versions the end
user has chosen to install.
The downside of including them upstream is that one should be a bit more
cautious when using stuff from bash-completion in case you want the
completions to work also when bash-completion is not installed.  Let us
know what you think.

Regarding the contents of the completions, they seem pretty fine on
surface (I don't have any of these tools installed to actually test
them), but here are some remarks from just looking at them, applicable
especially if you think it'd be better to include them in
bash-completion (see current bash-completion git code for examples):

- Use _init_completion(), and "words" and "cword" instead of COMP_WORDS
and COMP_CWORD.

- If fcoeadm can take long options that take arguments in both
"--foo=bar" and "--foo bar" forms, use _split_longopt() in it and be
sure to pass "-n =" to _init_completion().

- ${cur} should be placed in double quotes at end of all 'compgen -W's.



More information about the Bash-completion-devel mailing list