spcd/cd/__init__.py
Marc Beninca afffb8c90f
Some checks failed
/ job (push) Failing after 6s
clone_branch
2024-04-27 01:10:30 +02:00

29 lines
573 B
Python

import os
from rwx import ps
COMMANDS_PREFIX = 'cd-'
def cd_clone_branch():
ps.run('git',
'clone',
'--branch', os.environ['CD_PROJECT_BRANCH'],
'--',
os.environ['CD_PROJECT_URL'],
'.',
)
def cd_list_environment():
for variable, value in sorted(os.environ.items()):
print(variable, '=', value)
def install_commands(path):
user = '/usr/local/bin'
for command in [
'clone-branch',
'list-environment',
]:
os.symlink(path, os.path.join(user, f'{COMMANDS_PREFIX}{command}'))