Changed the CLI style

Remove the "container-" prefix in CLI to make the style closer
to Nova (i.e. nova boot ...) and Docker CLI (docker create ...).
* zun container-create -> zun create
* container-list -> zun list
* container-show -> zun show
* container-delete -> zun delete
* container-start -> zun start
* container-stop -> zun stop
* container-pause -> zun pause
* container-unpause -> zun unpause
* container-reboot -> zun reboot
* container-logs -> zun logs
* container-exec -> zun exec

Change-Id: I4dfc908c617142babcb9b68087b746dd6583ca35
This commit is contained in:
Hongbin Lu 2016-08-15 17:16:08 -05:00
parent b6155e7303
commit aa16ffb35a

View File

@ -39,7 +39,7 @@ def _show_container(container):
@utils.arg('--environment', @utils.arg('--environment',
metavar='<environment>', metavar='<environment>',
help='The environment variabled') help='The environment variabled')
def do_container_create(cs, args): def do_create(cs, args):
"""Create a container.""" """Create a container."""
opts = {} opts = {}
opts['name'] = args.name opts['name'] = args.name
@ -66,7 +66,7 @@ def do_container_create(cs, args):
metavar='<sort-dir>', metavar='<sort-dir>',
choices=['desc', 'asc'], choices=['desc', 'asc'],
help='Direction to sort. "asc" or "desc".') help='Direction to sort. "asc" or "desc".')
def do_container_list(cs, args): def do_list(cs, args):
"""Print a list of available containers.""" """Print a list of available containers."""
opts = {} opts = {}
opts['marker'] = args.marker opts['marker'] = args.marker
@ -84,7 +84,7 @@ def do_container_list(cs, args):
metavar='<container>', metavar='<container>',
nargs='+', nargs='+',
help='ID or name of the (container)s to delete.') help='ID or name of the (container)s to delete.')
def do_container_delete(cs, args): def do_delete(cs, args):
"""Delete specified containers.""" """Delete specified containers."""
for container in args.containers: for container in args.containers:
try: try:
@ -103,7 +103,7 @@ def do_container_delete(cs, args):
action='store_true', action='store_true',
default=False, default=False,
help='Print JSON representation of the container.') help='Print JSON representation of the container.')
def do_container_show(cs, args): def do_show(cs, args):
"""Show details of a container.""" """Show details of a container."""
container = cs.containers.get(args.container) container = cs.containers.get(args.container)
if args.json: if args.json:
@ -116,7 +116,7 @@ def do_container_show(cs, args):
metavar='<container>', metavar='<container>',
nargs='+', nargs='+',
help='ID or name of the (container)s to reboot.') help='ID or name of the (container)s to reboot.')
def do_container_reboot(cs, args): def do_reboot(cs, args):
"""Reboot specified containers.""" """Reboot specified containers."""
for container in args.containers: for container in args.containers:
try: try:
@ -132,7 +132,7 @@ def do_container_reboot(cs, args):
metavar='<container>', metavar='<container>',
nargs='+', nargs='+',
help='ID or name of the (container)s to stop.') help='ID or name of the (container)s to stop.')
def do_container_stop(cs, args): def do_stop(cs, args):
"""Stop specified containers.""" """Stop specified containers."""
for container in args.containers: for container in args.containers:
try: try:
@ -148,7 +148,7 @@ def do_container_stop(cs, args):
metavar='<container>', metavar='<container>',
nargs='+', nargs='+',
help='ID of the (container)s to start.') help='ID of the (container)s to start.')
def do_container_start(cs, args): def do_start(cs, args):
"""Start specified containers.""" """Start specified containers."""
for container in args.containers: for container in args.containers:
try: try:
@ -164,7 +164,7 @@ def do_container_start(cs, args):
metavar='<container>', metavar='<container>',
nargs='+', nargs='+',
help='ID or name of the (container)s to pause.') help='ID or name of the (container)s to pause.')
def do_container_pause(cs, args): def do_pause(cs, args):
"""Pause specified containers.""" """Pause specified containers."""
for container in args.containers: for container in args.containers:
try: try:
@ -180,7 +180,7 @@ def do_container_pause(cs, args):
metavar='<container>', metavar='<container>',
nargs='+', nargs='+',
help='ID or name of the (container)s to unpause.') help='ID or name of the (container)s to unpause.')
def do_container_unpause(cs, args): def do_unpause(cs, args):
"""Unpause specified containers.""" """Unpause specified containers."""
for container in args.containers: for container in args.containers:
try: try:
@ -195,7 +195,7 @@ def do_container_unpause(cs, args):
@utils.arg('container', @utils.arg('container',
metavar='<container>', metavar='<container>',
help='ID or name of the container to get logs for.') help='ID or name of the container to get logs for.')
def do_container_logs(cs, args): def do_logs(cs, args):
"""Get logs of a container.""" """Get logs of a container."""
logs = cs.containers.logs(args.container) logs = cs.containers.logs(args.container)
print(logs) print(logs)
@ -208,7 +208,7 @@ def do_container_logs(cs, args):
required=True, required=True,
metavar='<command>', metavar='<command>',
help='The command to execute') help='The command to execute')
def do_container_exec(cs, args): def do_exec(cs, args):
"""Execute command in a container.""" """Execute command in a container."""
output = cs.containers.execute(args.container, args.command) output = cs.containers.execute(args.container, args.command)
print(output) print(output)