diff --git a/cd.sh b/cd.sh index 626c577..b64ce20 100644 --- a/cd.sh +++ b/cd.sh @@ -573,17 +573,30 @@ ${CD_PYTHON_PACKAGES} cd_write_python_module () { cd_step "Write Python module" cd_write "${CD_PYTHON_PACKAGES}/env.py" "\ -CD_STEP = ${CD_STEP} - - -$(cd_echo CD_DOWN CD_VERTICAL CD_UP) - -$(cd_echo CD_OPEN CD_SHUT) - -$(cd_echo CD_SPLIT) - - $(cd_echo CD_OS_ID CD_OS_VERSION) + +STEP = ${CD_STEP} + + +def open(*arguments): + print('${CD_OPEN}', end=str()) + print(*arguments, flush=True) + + +def shut(*arguments): + print('${CD_SHUT}', end=str()) + print(*arguments, flush=True) + + +def split(): + print('${CD_SPLIT}', flush=True) + + +def step(*arguments): + STEP += 1 + print('${CD_DOWN}') + print('${CD_BOX_VERTICAL}', STEP, *arguments) + print('${CD_UP}', flush=True) " } @@ -714,7 +727,7 @@ cd_step () { CD_STEP=$((CD_STEP+1)) echo -n "\ ${CD_DOWN} -${CD_VERTICAL} ${CD_STEP} ${@} +${CD_BOX_VERTICAL} ${CD_STEP} ${@} ${CD_UP} " } @@ -759,7 +772,6 @@ CD_OPEN="${CD_BOX_DOWN}${CD_BOX_LEFT}" CD_SHUT="${CD_BOX_UP}${CD_BOX_LEFT}" CD_HORIZONTAL="${CD_BOX_HORIZONTAL}╌╌┄┄┈┈" -CD_VERTICAL="${CD_BOX_VERTICAL}" CD_DOWN="${CD_BOX_DOWN}${CD_HORIZONTAL}" CD_SPLIT="${CD_BOX_RIGHT}${CD_HORIZONTAL}" diff --git a/cd/__init__.py b/cd/__init__.py index 6bb0000..279a18f 100644 --- a/cd/__init__.py +++ b/cd/__init__.py @@ -90,8 +90,7 @@ def install_commands(path): def set_ssh(*arguments): ssh_key, ssh_hosts = arguments - # - ssh_type = 'ed25519' + ssh_type = projects.environment.get('CD_SSH_TYPE', 'ed25519') # home = os.path.expanduser('~') # @@ -108,24 +107,3 @@ def set_ssh(*arguments): if ssh_hosts: fs.write(known, ssh_hosts) os.chmod(known, 0o400) - - -def open(*arguments): - print(env.CD_OPEN, end=str()) - print(*arguments, flush=True) - - -def shut(*arguments): - print(env.CD_SHUT, end=str()) - print(*arguments, flush=True) - - -def split(): - print(env.CD_SPLIT, flush=True) - - -def step(*arguments): - env.CD_STEP += 1 - print(env.CD_DOWN) - print(env.CD_VERTICAL, env.CD_STEP, *arguments) - print(env.CD_UP, flush=True) diff --git a/cmd/cd-clone-python.sh b/cmd/cd-clone-python.sh new file mode 100755 index 0000000..52eb00e --- /dev/null +++ b/cmd/cd-clone-python.sh @@ -0,0 +1,15 @@ +[ "${1}" ] && REPOSITORY_FULL="${1}" || exit +REPOSITORY_NAME="$(basename ${REPOSITORY_FULL})" + +REPOSITORY_TEMP="$(mktemp --directory)" + +git clone \ +-- \ +"${GITHUB_SERVER_URL}/${REPOSITORY_FULL}" \ +"${REPOSITORY_TEMP}" + +mv "${REPOSITORY_TEMP}/${REPOSITORY_NAME}" \ +/usr/local/lib/python3.*/dist-packages/ + +rm --force --recursive \ +"${REPOSITORY_TEMP}"