gnulib-tool-py
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gnulib-tool-py] autocomplete arguments


From: Bruno Haible
Subject: Re: [gnulib-tool-py] autocomplete arguments
Date: Tue, 15 May 2012 12:36:14 +0200
User-agent: KMail/4.7.4 (Linux/3.1.10-1.9-desktop; KDE/4.7.4; x86_64; ; )

Hi Dmitriy,

> Recently I was surprised that there is module which provides autocomplete
> for options[1]. It was a pity to see that it uses optparse and it is not
> clear when it will be available for argparse. As you know optparse module
> is old and will be deprecated. However, autocomplete is a very useful
> feature. As I've understood we can provide similar possibility for
> argparse[2]. Is it a good idea?

You are proposing to use a specific approach for the command-line parsing
of gnulib-tool, so that bash's autocompletion (pressing tab after entering
the first part of a command-line option) will work?

I think this is overkill, because no specific support should be needed:
bash can autocomplete "cat --sho<TAB>", although the 'cat' program has
no specific support for it, and the /etc/bash_completion.d/ directory
also has nothing specific for the 'cat' program. AFAIU, this completion
works by invoking the program with argument --help and parsing the output.
The same approach will also work with gnulib-tool.

And even if a specific hack was needed, I think the right place would
be a file in /etc/bash_completion.d/. The GNU standards don't mention that
anything specific was needed in the program itself to support autocompletion
in bash, therefore I think there is no need to consider this in the
argument parsing code.

In other words, you can trust that using 'argparse' will not prevent
users from using bash autocompletion.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]