1

Tab auto-completion does not work "inside" commands, this is, for options.

For example, consider the help file of the command mousepad:

lucho@lucho-XPS15:~$ mousepad --help
Usage:
  mousepad [OPTION…] [FILES...]

Help Options:
  -h, --help               Show help options
  --help-all               Show all help options
  --help-gtk               Show GTK+ Options

Application Options:
  --disable-server         Do not register with the D-BUS session message bus
  -q, --quit               Quit a running Mousepad instance
  -v, --version            Print version information and exit
  --display=DISPLAY        X display to use

If I type mousepad --disable and then press autocomplete, nothing happens.

Why is this the case? Is there a way to enable this "extensive" tab auto-completion?

3

Why is this the case?

Because bash completion functions typically do not include arguments in completion.

Is there a way to enable this "extensive" tab auto-completion?

From this U&L post:

For some commands, bash will call the command with the argument --help and parse the output. Such commands can be registered with the complete built-in, e.g. complete -F _longopt ls. _longopt is in fact a completion generation function, that happens to parse a command's output rather than use a fixed list. (There are other more specialized completion functions that parse a command's output to generate possible completions; look in /etc/bash_completion.d/* for examples.)

So:

$ complete -F _longopt mousepad
$ mousepad --
--disable-server  --display=        --help            --help-all        --help-gtk        --quit            --version
  • Some commands do have this property though. dpkg – user308164 Jan 23 '17 at 11:44
  • @luchonacho ok. So? – muru Jan 23 '17 at 11:45
  • My question assumed none had, based on a poor exercise of induction. – user308164 Jan 23 '17 at 11:46

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy