mirror of
https://github.com/containers/podman-compose.git
synced 2025-04-12 03:28:33 +02:00
Merge pull request #1152 from IamTheFij/config-quiet
Add quiet flag to podman-compose config
This commit is contained in:
commit
3353697402
1
newsfragments/1152-config-quiet.feature
Normal file
1
newsfragments/1152-config-quiet.feature
Normal file
@ -0,0 +1 @@
|
||||
- Add a `--quiet` flag to the `config` command to suppress output.
|
@ -3136,9 +3136,11 @@ async def compose_logs(compose, args):
|
||||
async def compose_config(compose, args):
|
||||
if args.services:
|
||||
for service in compose.services:
|
||||
print(service)
|
||||
if not args.quiet:
|
||||
print(service)
|
||||
return
|
||||
print(compose.merged_yaml)
|
||||
if not args.quiet:
|
||||
print(compose.merged_yaml)
|
||||
|
||||
|
||||
@cmd_run(podman_compose, "port", "Prints the public port for a port binding.")
|
||||
@ -3672,6 +3674,12 @@ def compose_config_parse(parser):
|
||||
parser.add_argument(
|
||||
"--services", help="Print the service names, one per line.", action="store_true"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-q",
|
||||
"--quiet",
|
||||
help="Do not print config, only parse.",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
|
||||
@cmd_parse(podman_compose, "port")
|
||||
|
@ -80,3 +80,20 @@ class TestComposeConfig(unittest.TestCase, RunSubprocessMixin):
|
||||
actual_services[service] = service in actual_output
|
||||
|
||||
self.assertEqual(expected_services, actual_services)
|
||||
|
||||
def test_config_quiet(self):
|
||||
"""
|
||||
Tests podman-compose config command with the --quiet flag.
|
||||
"""
|
||||
config_cmd = [
|
||||
"coverage",
|
||||
"run",
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
profile_compose_file(),
|
||||
"config",
|
||||
"--quiet",
|
||||
]
|
||||
|
||||
out, _ = self.run_subprocess_assert_returncode(config_cmd)
|
||||
self.assertEqual(out.decode("utf-8"), "")
|
||||
|
Loading…
Reference in New Issue
Block a user