Skip to content

Commit 3353697

Browse files
authored
Merge pull request #1152 from IamTheFij/config-quiet
Add quiet flag to podman-compose config
2 parents ca1b59c + 4cd1642 commit 3353697

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Add a `--quiet` flag to the `config` command to suppress output.

podman_compose.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -3136,9 +3136,11 @@ async def compose_logs(compose, args):
31363136
async def compose_config(compose, args):
31373137
if args.services:
31383138
for service in compose.services:
3139-
print(service)
3139+
if not args.quiet:
3140+
print(service)
31403141
return
3141-
print(compose.merged_yaml)
3142+
if not args.quiet:
3143+
print(compose.merged_yaml)
31423144

31433145

31443146
@cmd_run(podman_compose, "port", "Prints the public port for a port binding.")
@@ -3672,6 +3674,12 @@ def compose_config_parse(parser):
36723674
parser.add_argument(
36733675
"--services", help="Print the service names, one per line.", action="store_true"
36743676
)
3677+
parser.add_argument(
3678+
"-q",
3679+
"--quiet",
3680+
help="Do not print config, only parse.",
3681+
action="store_true",
3682+
)
36753683

36763684

36773685
@cmd_parse(podman_compose, "port")

tests/integration/profile/test_podman_compose_config.py

+17
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,20 @@ def test_config_profiles(self, profiles, expected_services):
8080
actual_services[service] = service in actual_output
8181

8282
self.assertEqual(expected_services, actual_services)
83+
84+
def test_config_quiet(self):
85+
"""
86+
Tests podman-compose config command with the --quiet flag.
87+
"""
88+
config_cmd = [
89+
"coverage",
90+
"run",
91+
podman_compose_path(),
92+
"-f",
93+
profile_compose_file(),
94+
"config",
95+
"--quiet",
96+
]
97+
98+
out, _ = self.run_subprocess_assert_returncode(config_cmd)
99+
self.assertEqual(out.decode("utf-8"), "")

0 commit comments

Comments
 (0)