Add missing `-q|--quiet` options to increase consistency

Signed-off-by: Harald Albers <github@albersweb.de>
This commit is contained in:
Harald Albers 2018-01-30 00:57:07 +01:00
parent 520fad331f
commit 6cfbb7ed8a
3 changed files with 12 additions and 12 deletions

View File

@ -503,14 +503,14 @@ class TopLevelCommand(object):
Usage: images [options] [SERVICE...]
Options:
-q Only display IDs
-q, --quiet Only display IDs
"""
containers = sorted(
self.project.containers(service_names=options['SERVICE'], stopped=True) +
self.project.containers(service_names=options['SERVICE'], one_off=OneOffFilter.only),
key=attrgetter('name'))
if options['-q']:
if options['--quiet']:
for image in set(c.image for c in containers):
print(image.split(':')[1])
else:
@ -624,12 +624,12 @@ class TopLevelCommand(object):
Usage: ps [options] [SERVICE...]
Options:
-q Only display IDs
-q, --quiet Only display IDs
--services Display services
--filter KEY=VAL Filter services by a property
"""
if options['-q'] and options['--services']:
raise UserError('-q and --services cannot be combined')
if options['--quiet'] and options['--services']:
raise UserError('--quiet and --services cannot be combined')
if options['--services']:
filt = build_filter(options.get('--filter'))
@ -644,7 +644,7 @@ class TopLevelCommand(object):
self.project.containers(service_names=options['SERVICE'], one_off=OneOffFilter.only),
key=attrgetter('name'))
if options['-q']:
if options['--quiet']:
for container in containers:
print(container.id)
else:
@ -676,7 +676,7 @@ class TopLevelCommand(object):
Options:
--ignore-pull-failures Pull what it can and ignores images with pull failures.
--parallel Pull multiple images in parallel.
--quiet Pull without printing progress information
-q, --quiet Pull without printing progress information
"""
self.project.pull(
service_names=options['SERVICE'],

View File

@ -259,7 +259,7 @@ _docker_compose_help() {
_docker_compose_images() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--help -q" -- "$cur" ) )
COMPREPLY=( $( compgen -W "--help --quiet -q" -- "$cur" ) )
;;
*)
__docker_compose_services_all
@ -361,7 +361,7 @@ _docker_compose_ps() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--help -q --services --filter" -- "$cur" ) )
COMPREPLY=( $( compgen -W "--help --quiet -q --services --filter" -- "$cur" ) )
;;
*)
__docker_compose_services_all
@ -373,7 +373,7 @@ _docker_compose_ps() {
_docker_compose_pull() {
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--help --ignore-pull-failures --parallel --quiet" -- "$cur" ) )
COMPREPLY=( $( compgen -W "--help --ignore-pull-failures --parallel --quiet -q" -- "$cur" ) )
;;
*)
__docker_compose_services_from_image

View File

@ -207,13 +207,13 @@ class CLITestCase(DockerClientTestCase):
self.base_dir = None
result = self.dispatch([
'-f', 'tests/fixtures/invalid-composefile/invalid.yml',
'config', '-q'
'config', '--quiet'
], returncode=1)
assert "'notaservice' must be a mapping" in result.stderr
def test_config_quiet(self):
self.base_dir = 'tests/fixtures/v2-full'
assert self.dispatch(['config', '-q']).stdout == ''
assert self.dispatch(['config', '--quiet']).stdout == ''
def test_config_default(self):
self.base_dir = 'tests/fixtures/v2-full'