import os from pathlib import Path from pidd import browse, project, projects from rwx import ps, split from rwx.log import log def pidd_browse_workspace() -> None: browse(project.root) def pidd_build_project() -> None: for extension in ["py", "sh"]: path = Path(project.root) / f"build.{extension}" if path.exists(): ps.run(path) break else: pass def pidd_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 pidd_list_environment() -> None: for variable, value in sorted(projects.environment.items()): log.info(f"{variable} = {value}") def pidd_synchronize() -> None: host = "rwx.work" source = "out" user = "cd" # root = Path(os.sep) / user / project.branch / projects.group / project.name # target = f"{user}@{host}:{root}" ps.run( "rsync", "--archive", "--delete-before", "--verbose", f"{source}/", f"{target}/", "--dry-run", )