diff --git a/spcd/__init__.py b/spcd/__init__.py index 8d5ab7d..90442b2 100644 --- a/spcd/__init__.py +++ b/spcd/__init__.py @@ -9,13 +9,34 @@ from rwx import fs from rwx.log import stream as log from rwx.ps import run -import spcd from spcd import cmd -from spcd.util import browse, cat, step +from spcd.ci import project, projects +from spcd.util import browse, cat, split, step COMMANDS_PREFIX = "spcd-" +def clone_project_branch() -> None: + step("Clone project branch") + log.info(projects) + split() + log.info(project) + split() + log.info(f"""\ +{project.url} +↓ +""") + run( + "git", + "clone", + "--branch", + project.branch, + "--", + project.url, + project.root, + ) + + def install_commands(path: str) -> None: step("Install commands") user = Path("/usr/local/bin") @@ -34,8 +55,9 @@ def main(main: str) -> None: path, *arguments = sys.argv name = Path(path).name if name == "__main__.py": - spcd.set_ssh(*arguments) - spcd.install_commands(main) + clone_project_branch() + set_ssh(*arguments) + install_commands(main) else: function = getattr(cmd, name.replace("-", "_")) function(*arguments) diff --git a/spcd/cmd.py b/spcd/cmd.py index 79531d4..052a9f0 100644 --- a/spcd/cmd.py +++ b/spcd/cmd.py @@ -6,7 +6,7 @@ from rwx import ps from rwx.log import stream as log from spcd.ci import project, projects -from spcd.util import browse, split +from spcd.util import browse def spcd_browse_workspace() -> None: @@ -23,26 +23,6 @@ def spcd_build_project() -> None: pass -def spcd_clone_branch() -> None: - log.info(projects) - split() - log.info(project) - split() - log.info(f"""\ -{project.url} -↓ -""") - ps.run( - "git", - "clone", - "--branch", - project.branch, - "--", - project.url, - project.root, - ) - - def spcd_list_environment() -> None: for variable, value in sorted(projects.environment.items()): log.info(f"{variable} = {value}")