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 | 06d1f3f515c20859ca76685bb236d86afc289434 (patch) | |
| tree | d368a79093e365f66220ded97f0053e95e22ca4e | |
| parent | 44bdfe8c06c4549a43d34c446cda07a19f499cc9 (diff) | |
| download | crupest-06d1f3f515c20859ca76685bb236d86afc289434.tar.gz crupest-06d1f3f515c20859ca76685bb236d86afc289434.tar.bz2 crupest-06d1f3f515c20859ca76685bb236d86afc289434.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...")  | 
