This commit is contained in:
Marc Beninca 2024-06-09 20:28:09 +02:00
parent 3b66390840
commit 371d66cb61
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
2 changed files with 6 additions and 7 deletions

View file

@ -83,7 +83,7 @@ def cat(file: str) -> None:
shut(file) shut(file)
def install_commands(path) -> None: def install_commands(path: str) -> None:
step("Install commands") step("Install commands")
user = Path("/usr/local/bin") user = Path("/usr/local/bin")
for command in [ for command in [
@ -94,7 +94,7 @@ def install_commands(path) -> None:
"synchronize", "synchronize",
]: ]:
print(command) print(command)
os.symlink(path, user / f"{COMMANDS_PREFIX}{command}") (user / f"{COMMANDS_PREFIX}{command}").symlink_to(path)
def set_ssh(*arguments) -> None: def set_ssh(*arguments) -> None:

View file

@ -6,12 +6,11 @@ from pathlib import Path
import cd import cd
if __name__ == "__main__": if __name__ == "__main__":
command, *arguments = sys.argv path, *arguments = sys.argv
command = Path(command).name name = Path(path).name
if command == "__main__.py": if name == "__main__.py":
cd.set_ssh(*arguments) cd.set_ssh(*arguments)
cd.install_commands(__file__) cd.install_commands(__file__)
else: else:
command = command.replace("-", "_") function = getattr(cd, name.replace("-", "_"))
function = getattr(cd, command)
function(*arguments) function(*arguments)