2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-21 14:49:41 +00:00
Commit Graph

5 Commits

Author SHA1 Message Date
Alex Wang
b8905bfa9d ovs-command-completion: Complete on file path by default.
This commit makes the bash completion script complete on file
path when there is no completion available.  The unit tests
are also adjusted accordingly.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-02-03 17:57:55 -08:00
Alex Wang
1b8c7b961c ovs-command-completion: Avoid using negative subscript.
Negative subscript causes error in bash version 4.1.2(1)-release
(x86_64-redhat-linux-gnu).  This commit fixes it.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-02-01 21:21:38 -08:00
Alex Wang
1fdbfd4e98 ovs-command-compgen: Avoid using GNU sed extensions.
This commit changes '\?' to '\{0,1\}' to avoid using GNU
sed extension.

Found by using the script in FreeBSD.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-01-05 10:14:49 -08:00
Alex Wang
9a8d2f8c49 ovs-command-completion: Fix unwanted whitespace.
This commit fixes unwanted whitespace in the ovs
bash completion script output.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
2014-12-13 21:47:35 -08:00
Alex Wang
423ede182b 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>
2014-10-30 11:22:26 -07:00