[Bash-completion-devel] hostname completion issues
Guillaume Rousse
Guillaume.Rousse at inria.fr
Wed Jun 24 20:29:16 UTC 2009
Freddy Vulto a écrit :
> On Thu, Jun 18, 2009 at 10:34 AM, Guillaume
> Rousse<Guillaume.Rousse at inria.fr> wrote:
>> _known_hosts_real was supposed to have a mandatory host argument, by
>> contrast to _known_hosts. Otherwise, there is no use to split those two
>> functions, we could use a single one.
>>
>> And I favor the splitted solution because:
>> - calling directly the function with the proper behaviour is faster than
>> having this function test its argument at runtime to select which behavior
>> to use
>> - distinguishing between completion functions (those directly attached to a
>> command) and helper functions (those called by completion functions) make
>> the code easier to maintain
>> - bash isn't wise enough to to distinguish between an empty string argument
>> and an non-existing one: calling the '_known_host -a' function with no
>> current host will call '_known_host_real -h "" -a', and result in completion
>> for hosts called -a*
>
> A mandatory argument which is allowed to be empty sounds like a
> contradiction to me, that's why I made it an option.
mandatory means 'always present', not 'not empty'. I'd prefer to keep
options for optional argument (using getopt for internal functions is
already awful enough IMHO).
That's exactly the same situation than _filedir, which is supposed to be
always called for completing a directory name, even if this one is
empty. It uses a global variable, tough... This makes room for enhancing
API consistency here.
--
BOFH excuse #206:
Police are examining all internet packets in the search for a
narco-net-trafficker
More information about the Bash-completion-devel
mailing list