spcd/cd/__init__.py
Marc Beninca 5bbcb10091
Some checks failed
/ job (push) Failing after 6s
environ
2024-04-27 16:52:52 +02:00

35 lines
694 B
Python

import os
from cd.project import Project
from cd.projects import Projects
from rwx import ps
COMMANDS_PREFIX = 'cd-'
environment = os.environ
project = Project(environment)
projects = Projects(environment)
def cd_clone_branch():
ps.run('git',
'clone',
'--branch', project.branch,
'--',
project.url,
'.',
)
def cd_list_environment():
for variable, value in sorted(environment.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}'))