This commit is contained in:
Marc Beninca 2024-06-09 17:23:57 +02:00
parent ab2560ded2
commit 807049f27b
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -12,11 +12,11 @@ projects = Projects(os.environ)
project = Project(projects)
def cd_browse_workspace():
def cd_browse_workspace() -> None:
browse(project.root)
def cd_build_project():
def cd_build_project() -> None:
for extension in ["py", "sh"]:
path = os.path.join(project.root, f"build.{extension}")
if os.path.exists(path):
@ -26,7 +26,7 @@ def cd_build_project():
pass
def cd_clone_branch():
def cd_clone_branch() -> None:
print(f"""\
{project.url}
@ -40,12 +40,12 @@ def cd_clone_branch():
)
def cd_list_environment():
def cd_list_environment() -> None:
for variable, value in sorted(projects.environment.items()):
print(variable, "=", value)
def cd_synchronize():
def cd_synchronize() -> None:
host = "rwx.work"
source = "out"
user = "cd"
@ -64,7 +64,7 @@ def cd_synchronize():
)
def browse(root: str):
def browse(root: str) -> None:
paths = []
for directory, _, files in os.walk(root):
for file in files:
@ -77,13 +77,13 @@ def browse(root: str):
shut(root)
def cat(file: str):
def cat(file: str) -> None:
open(file)
print(fs.read_file_text(file).rstrip())
shut(file)
def install_commands(path):
def install_commands(path) -> None:
step("Install commands")
user = "/usr/local/bin"
for command in [
@ -97,7 +97,7 @@ def install_commands(path):
os.symlink(path, os.path.join(user, f"{COMMANDS_PREFIX}{command}"))
def set_ssh(*arguments):
def set_ssh(*arguments) -> None:
step("Set SSH")
#
ssh_key, ssh_hosts = arguments
@ -124,21 +124,21 @@ def set_ssh(*arguments):
cat(known)
def open(*arguments):
def open(*arguments) -> None:
print(env.CD_OPEN, end="")
print(*arguments, flush=True)
def shut(*arguments):
def shut(*arguments) -> None:
print(env.CD_SHUT, end="")
print(*arguments, flush=True)
def split():
def split() -> None:
print(env.CD_SPLT, flush=True)
def step(*arguments):
def step(*arguments) -> None:
env.CD_STEP += 1
print(env.CD_DOWN)
print(env.CD_VERT, env.CD_STEP, *arguments)