This commit is contained in:
Marc Beninca 2024-06-21 12:10:09 +02:00
parent a49364305f
commit 0702fae0e9
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
2 changed files with 14 additions and 11 deletions

View file

@ -3,12 +3,14 @@
__version__ = "0.0.1"
import os
import sys
from pathlib import Path
import env
from rwx import fs, ps
from rwx.log import stream as log
import cd
from cd.project import Project
from cd.projects import Projects
@ -113,6 +115,17 @@ def install_commands(path: str) -> None:
(user / f"{COMMANDS_PREFIX}{command}").symlink_to(path)
def main() -> None:
path, *arguments = sys.argv
name = Path(path).name
if name == "__main__.py":
cd.set_ssh(*arguments)
cd.install_commands(__file__)
else:
function = getattr(cd, name.replace("-", "_"))
function(*arguments)
def set_ssh(*arguments: str) -> None:
step("Set SSH")
#

View file

@ -2,17 +2,7 @@
"""Entry point to either bootstrap or command."""
import sys
from pathlib import Path
import cd
if __name__ == "__main__":
path, *arguments = sys.argv
name = Path(path).name
if name == "__main__.py":
cd.set_ssh(*arguments)
cd.install_commands(__file__)
else:
function = getattr(cd, name.replace("-", "_"))
function(*arguments)
cd.main(__file__)