summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xryu/cmd/rpc_cli.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/ryu/cmd/rpc_cli.py b/ryu/cmd/rpc_cli.py
index ac542143..2519c8bb 100755
--- a/ryu/cmd/rpc_cli.py
+++ b/ryu/cmd/rpc_cli.py
@@ -43,8 +43,12 @@ from ryu.lib import rpc
CONF = cfg.CONF
CONF.register_cli_opts([
- # eg. rpc-cli --peers=hoge=localhost:9998,fuga=localhost:9999
- cfg.ListOpt('peers', default=[], help='list of peers')
+ cfg.ListOpt('peers', default=[],
+ help='List of peers, separated by commas. '
+ '(e.g., "hoge=localhost:9998,fuga=localhost:9999")'),
+ cfg.StrOpt('command', short='c', default=None,
+ help='Command to be executed as single command. '
+ 'The default is None and opens interactive console.'),
])
@@ -229,6 +233,11 @@ def main(args=None, prog=None):
host, port = addr.rsplit(':', 1)
add_peer(name, host, port)
+ if CONF.command:
+ command = Cmd()
+ command.onecmd(CONF.command)
+ command.do_EOF()
+
Cmd().cmdloop()