diff options
author | crupest <crupest@outlook.com> | 2022-11-29 09:43:45 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-11-29 09:43:45 +0800 |
commit | 3e8ec3cf4e2b871d5de793535272705d572b592a (patch) | |
tree | d368a79093e365f66220ded97f0053e95e22ca4e | |
parent | bdb44e75c6038394b00901f0c9359d75dbade207 (diff) | |
download | crupest-3e8ec3cf4e2b871d5de793535272705d572b592a.tar.gz crupest-3e8ec3cf4e2b871d5de793535272705d572b592a.tar.bz2 crupest-3e8ec3cf4e2b871d5de793535272705d572b592a.zip |
Add up and down to aio.
-rwxr-xr-x | tool/aio.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/tool/aio.py b/tool/aio.py index 7b3e62e..74ad9e9 100755 --- a/tool/aio.py +++ b/tool/aio.py @@ -119,6 +119,9 @@ git_update_parser = subparsers.add_parser( up_parser = subparsers.add_parser( "up", help="Do something necessary and then docker compose up.") +down_parser = subparsers.add_parser( + "down", help="Do something necessary and then docker compose down.") + args = parser.parse_args() if args.yes: @@ -398,8 +401,7 @@ def clean(template_name_list): def git_update(): def do_it(): - subprocess.run(["git", "submodule", "update", - "--init", "--recursive"], check=True) + subprocess.run(["git", "pull"], check=True) run_in_project_dir(do_it) @@ -409,6 +411,13 @@ def docker_compose_up(): run_in_dir(project_abs_path, do_docker_compose_up) +def docker_compose_down(): + def do_docker_compose_down(): + subprocess.run( + ["docker", "compose", "down"], check=True) + run_in_dir(project_abs_path, do_docker_compose_down) + + action = args.action @@ -425,10 +434,7 @@ def run(): case "up": docker_compose_up() case "down": - def docker_compose_down(): - subprocess.run( - ["docker", "compose", "down"], check=True) - run_in_dir(project_abs_path, docker_compose_down) + docker_compose_down() case "prune": to_do = Confirm.ask( "[yellow]Are you sure to prune docker?[/]", console=console) @@ -518,6 +524,9 @@ def run(): git_update() docker_compose_up() + case "down": + docker_compose_down() + case _: console.print("First let's check all the templates...") |