parent
9c63b1e9c3
commit
678d9e0e4d
3 changed files with 47 additions and 42 deletions
|
@ -1,40 +1,20 @@
|
|||
"""Python Integration, Delivery & Deployment."""
|
||||
"""Shell to Python Continuous Deployment."""
|
||||
|
||||
__version__ = "0.0.1"
|
||||
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import env
|
||||
from rwx import fs
|
||||
from rwx.log import stream as log
|
||||
|
||||
import spcd
|
||||
from spcd import cmd
|
||||
from spcd.util import browse, cat, step
|
||||
|
||||
COMMANDS_PREFIX = "spcd-"
|
||||
|
||||
|
||||
def browse(root: str) -> None:
|
||||
paths = []
|
||||
for directory, _, files in os.walk(root):
|
||||
for file in files:
|
||||
absolute_path = Path(directory) / file
|
||||
relative_path = os.path.relpath(absolute_path, start=root)
|
||||
paths.append(relative_path)
|
||||
frame(root)
|
||||
for path in sorted(paths):
|
||||
log.info(path)
|
||||
shut(root)
|
||||
|
||||
|
||||
def cat(file: str) -> None:
|
||||
frame(file)
|
||||
log.info(fs.read_file_text(file).rstrip())
|
||||
shut(file)
|
||||
|
||||
|
||||
def install_commands(path: str) -> None:
|
||||
step("Install commands")
|
||||
user = Path("/usr/local/bin")
|
||||
|
@ -85,22 +65,3 @@ def set_ssh(*arguments: list[str]) -> None:
|
|||
# display
|
||||
browse(ssh)
|
||||
cat(known)
|
||||
|
||||
|
||||
def frame(text: str) -> None:
|
||||
log.info(f"{env.SPCD_OPEN}{text}")
|
||||
|
||||
|
||||
def shut(text: str) -> None:
|
||||
log.info(f"{env.SPCD_SHUT}{text}")
|
||||
|
||||
|
||||
def split() -> None:
|
||||
log.info(env.SPCD_SPLT)
|
||||
|
||||
|
||||
def step(text: str) -> None:
|
||||
env.SPCD_STEP += 1
|
||||
log.info(env.SPCD_DOWN)
|
||||
log.info(f"{env.SPCD_VERT} {env.SPCD_STEP} {text}")
|
||||
log.info(env.SPCD___UP)
|
||||
|
|
|
@ -4,8 +4,8 @@ from pathlib import Path
|
|||
from rwx import ps
|
||||
from rwx.log import stream as log
|
||||
|
||||
from spcd import browse, split
|
||||
from spcd.ci import project, projects
|
||||
from spcd.util import browse, split
|
||||
|
||||
|
||||
def spcd_browse_workspace() -> None:
|
||||
|
|
44
spcd/util.py
Normal file
44
spcd/util.py
Normal file
|
@ -0,0 +1,44 @@
|
|||
import os
|
||||
from pathlib import Path
|
||||
|
||||
import env
|
||||
from rwx import fs
|
||||
from rwx.log import stream as log
|
||||
|
||||
|
||||
def browse(root: str) -> None:
|
||||
paths = []
|
||||
for directory, _, files in os.walk(root):
|
||||
for file in files:
|
||||
absolute_path = Path(directory) / file
|
||||
relative_path = os.path.relpath(absolute_path, start=root)
|
||||
paths.append(relative_path)
|
||||
frame(root)
|
||||
for path in sorted(paths):
|
||||
log.info(path)
|
||||
shut(root)
|
||||
|
||||
|
||||
def cat(file: str) -> None:
|
||||
frame(file)
|
||||
log.info(fs.read_file_text(file).rstrip())
|
||||
shut(file)
|
||||
|
||||
|
||||
def frame(text: str) -> None:
|
||||
log.info(f"{env.SPCD_OPEN}{text}")
|
||||
|
||||
|
||||
def shut(text: str) -> None:
|
||||
log.info(f"{env.SPCD_SHUT}{text}")
|
||||
|
||||
|
||||
def split() -> None:
|
||||
log.info(env.SPCD_SPLT)
|
||||
|
||||
|
||||
def step(text: str) -> None:
|
||||
env.SPCD_STEP += 1
|
||||
log.info(env.SPCD_DOWN)
|
||||
log.info(f"{env.SPCD_VERT} {env.SPCD_STEP} {text}")
|
||||
log.info(env.SPCD___UP)
|
Loading…
Reference in a new issue