mirror of https://github.com/docker/compose.git
Add --volumes flag to config command
Closes #3609 Signed-off-by: Evan Shaw <evan@vendhq.com>
This commit is contained in:
parent
a953651597
commit
d67261f26e
|
@ -301,6 +301,7 @@ class TopLevelCommand(object):
|
||||||
-q, --quiet Only validate the configuration, don't print
|
-q, --quiet Only validate the configuration, don't print
|
||||||
anything.
|
anything.
|
||||||
--services Print the service names, one per line.
|
--services Print the service names, one per line.
|
||||||
|
--volumes Print the volume names, one per line.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
compose_config = get_config_from_options(self.project_dir, config_options)
|
compose_config = get_config_from_options(self.project_dir, config_options)
|
||||||
|
@ -312,6 +313,10 @@ class TopLevelCommand(object):
|
||||||
print('\n'.join(service['name'] for service in compose_config.services))
|
print('\n'.join(service['name'] for service in compose_config.services))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if options['--volumes']:
|
||||||
|
print('\n'.join(volume for volume in compose_config.volumes))
|
||||||
|
return
|
||||||
|
|
||||||
print(serialize_config(compose_config))
|
print(serialize_config(compose_config))
|
||||||
|
|
||||||
def create(self, options):
|
def create(self, options):
|
||||||
|
|
|
@ -177,6 +177,11 @@ class CLITestCase(DockerClientTestCase):
|
||||||
result = self.dispatch(['config', '--services'])
|
result = self.dispatch(['config', '--services'])
|
||||||
assert set(result.stdout.rstrip().split('\n')) == {'web', 'other'}
|
assert set(result.stdout.rstrip().split('\n')) == {'web', 'other'}
|
||||||
|
|
||||||
|
def test_config_list_volumes(self):
|
||||||
|
self.base_dir = 'tests/fixtures/v2-full'
|
||||||
|
result = self.dispatch(['config', '--volumes'])
|
||||||
|
assert set(result.stdout.rstrip().split('\n')) == {'data'}
|
||||||
|
|
||||||
def test_config_quiet_with_error(self):
|
def test_config_quiet_with_error(self):
|
||||||
self.base_dir = None
|
self.base_dir = None
|
||||||
result = self.dispatch([
|
result = self.dispatch([
|
||||||
|
|
Loading…
Reference in New Issue