fix: update command parsers to require explicit service arguments
This commit is contained in:
parent
f53297b17f
commit
d3a00bef3e
@ -265,23 +265,15 @@ def main():
|
|||||||
|
|
||||||
# Start command
|
# Start command
|
||||||
start_parser = subparsers.add_parser("start", help="Start a Docker service")
|
start_parser = subparsers.add_parser("start", help="Start a Docker service")
|
||||||
start_parser_group = start_parser.add_mutually_exclusive_group(required=True)
|
start_group = start_parser.add_mutually_exclusive_group(required=True)
|
||||||
start_parser_group.add_argument(
|
start_group.add_argument("--all", action="store_true", help="Start all services")
|
||||||
"--all", action="store_true", help="Start all services"
|
start_group.add_argument("--service", dest="service", help="Service to start")
|
||||||
)
|
|
||||||
start_parser_group.add_argument("service", nargs="?", help="Service to start")
|
|
||||||
|
|
||||||
# Stop command
|
# Stop command
|
||||||
stop_parser = subparsers.add_parser("stop", help="Stop a Docker service")
|
stop_parser = subparsers.add_parser("stop", help="Stop a Docker service")
|
||||||
stop_parser_group = stop_parser.add_mutually_exclusive_group(required=False)
|
stop_group = stop_parser.add_mutually_exclusive_group(required=True)
|
||||||
stop_parser_group.add_argument(
|
stop_group.add_argument("--all", action="store_true", help="Stop all running services")
|
||||||
"--all", action="store_true", help="Stop all running services"
|
stop_group.add_argument("--service", dest="service", help="Service to stop")
|
||||||
)
|
|
||||||
stop_parser_group.add_argument("service", help="Service to stop")
|
|
||||||
|
|
||||||
# Make one of the arguments required
|
|
||||||
stop_parser.set_defaults(service=None)
|
|
||||||
stop_parser_group.required = True
|
|
||||||
|
|
||||||
# Restart command
|
# Restart command
|
||||||
restart_parser = subparsers.add_parser("restart", help="Restart a Docker service")
|
restart_parser = subparsers.add_parser("restart", help="Restart a Docker service")
|
||||||
@ -292,11 +284,11 @@ def main():
|
|||||||
"update",
|
"update",
|
||||||
help="Update a Docker service (pull new images and recreate if needed)",
|
help="Update a Docker service (pull new images and recreate if needed)",
|
||||||
)
|
)
|
||||||
update_parser_group = update_parser.add_mutually_exclusive_group(required=True)
|
update_group = update_parser.add_mutually_exclusive_group(required=True)
|
||||||
update_parser_group.add_argument(
|
update_group.add_argument(
|
||||||
"--all", action="store_true", help="Update all running services"
|
"--all", action="store_true", help="Update all running services"
|
||||||
)
|
)
|
||||||
update_parser_group.add_argument("service", nargs="?", help="Service to update")
|
update_group.add_argument("--service", dest="service", help="Service to update")
|
||||||
|
|
||||||
# PS command
|
# PS command
|
||||||
ps_parser = subparsers.add_parser("ps", help="Show Docker service status")
|
ps_parser = subparsers.add_parser("ps", help="Show Docker service status")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user