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

View file

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