From 65500eb06ee13bc3f76497397b8420964bde87fe Mon Sep 17 00:00:00 2001 From: chendelin1982 <27513732@qq.com> Date: Sun, 26 Sep 2021 23:05:59 +0800 Subject: [PATCH] gitclone --- cli/controller.py | 18 ++++++++++++++++-- cli/model.py | 3 --- cli/stackhub.py | 6 +++++- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/cli/controller.py b/cli/controller.py index 532fe10d..fa185445 100644 --- a/cli/controller.py +++ b/cli/controller.py @@ -1,12 +1,26 @@ -import model +import model, os path_repo = "./data/application.list" path_project = "" +# for Git clone HA +github_url = ("https://github.com", "https://github.com.cnpmjs.org", "https://hub.fastgit.org") + class Print: def __init__(self): pass def printRepo(): - model.FileOp.printJson(path_repo) \ No newline at end of file + model.FileOp.printJson(path_repo) + + +class Github: + + def __init__(self): + pass + + def gitClone(name: str): + cmd = "git clone --depth=1 " + model.SmoothUrl.res(github_url) + "/websoft9/docker-" + name + " repo/docker-"+name + print(cmd) + os.system(cmd) \ No newline at end of file diff --git a/cli/model.py b/cli/model.py index 46881b6b..9d5d2e60 100644 --- a/cli/model.py +++ b/cli/model.py @@ -5,9 +5,6 @@ from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Type, U import urllib.parse import urllib.request -# for Git clone HA -github_url = ("https://github.com", "https://github.com.cnpmjs.org", "https://hub.fastgit.org") - class SmoothUrl: ''' get url ''' diff --git a/cli/stackhub.py b/cli/stackhub.py index a07d1a3e..f98747a1 100644 --- a/cli/stackhub.py +++ b/cli/stackhub.py @@ -12,7 +12,11 @@ app = typer.Typer() def list(): '''print the lists file''' controller.Print.printRepo() - + +@app.command() +def gitclone(name: str): + '''git clone''' + controller.Github.gitClone(name) @app.command() def update(name: str):