main
This commit is contained in:
parent
a49364305f
commit
0702fae0e9
2 changed files with 14 additions and 11 deletions
|
@ -3,12 +3,14 @@
|
||||||
__version__ = "0.0.1"
|
__version__ = "0.0.1"
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import env
|
import env
|
||||||
from rwx import fs, ps
|
from rwx import fs, ps
|
||||||
from rwx.log import stream as log
|
from rwx.log import stream as log
|
||||||
|
|
||||||
|
import cd
|
||||||
from cd.project import Project
|
from cd.project import Project
|
||||||
from cd.projects import Projects
|
from cd.projects import Projects
|
||||||
|
|
||||||
|
@ -113,6 +115,17 @@ def install_commands(path: str) -> None:
|
||||||
(user / f"{COMMANDS_PREFIX}{command}").symlink_to(path)
|
(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:
|
def set_ssh(*arguments: str) -> None:
|
||||||
step("Set SSH")
|
step("Set SSH")
|
||||||
#
|
#
|
||||||
|
|
|
@ -2,17 +2,7 @@
|
||||||
|
|
||||||
"""Entry point to either bootstrap or command."""
|
"""Entry point to either bootstrap or command."""
|
||||||
|
|
||||||
import sys
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import cd
|
import cd
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
path, *arguments = sys.argv
|
cd.main(__file__)
|
||||||
name = Path(path).name
|
|
||||||
if name == "__main__.py":
|
|
||||||
cd.set_ssh(*arguments)
|
|
||||||
cd.install_commands(__file__)
|
|
||||||
else:
|
|
||||||
function = getattr(cd, name.replace("-", "_"))
|
|
||||||
function(*arguments)
|
|
||||||
|
|
Loading…
Reference in a new issue