utilities: Add bash command-line completion script.
authorAlex Wang <alexw@nicira.com>
Mon, 20 Oct 2014 04:36:58 +0000 (21:36 -0700)
committerAlex Wang <alexw@nicira.com>
Thu, 30 Oct 2014 18:22:26 +0000 (11:22 -0700)
commit423ede182b650bbdc3845ebaa5921cb064fdf083
treecb92c90bb5d8ca28dce3cf31f24799d5af9ab1bc
parent03ec3f12967349d5f744f18c71f2a81487da6117
utilities: Add bash command-line completion script.

This patch adds bash command-line completion script for ovs-appctl,
ovs-dpctl, ovs-ofctl and ovsdb-tool command.  Right now, the script
can do the following:

- display available completion or complete on unfinished user input
  (long option, subcommand, and argument).

- once the subcommand (e.g. ofproto/trace) has been given, the
  script will print the subcommand format.

- the script can convert between keywords like 'bridge/port/interface/dp'
  and the available record in ovsdb.

The limitations are:

- only support small set of important keywords
  (dp, datapath, bridge, switch, port, interface, iface).

- does not support parsing of nested options
  (e.g. ovsdb-tool create [db [schema]]).

- does not support expansion on repeatitive argument
  (e.g. ovs-dpctl show [dp...]).

- only support matching on long options, and only in the format
  (--option [arg], i.e. should not use --option=[arg]).

To use the script, either copy it inside /etc/bash_completion.d/
or manually run it via . ovs-command-compgen.bash.

Also, a unit testsuite is provided as ovs-command-compgen-test.bash.
It is suggested that this test script be run only inside
tutorial/sandbox directory.

For more info please refer to utilities/ovs-command-compgen.INSTALL.md.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
NEWS
utilities/automake.mk
utilities/ovs-command-compgen-test.bash [new file with mode: 0755]
utilities/ovs-command-compgen.INSTALL.md [new file with mode: 0644]
utilities/ovs-command-compgen.bash [new file with mode: 0755]