parent
5bbcb10091
commit
fedeec960d
3 changed files with 12 additions and 9 deletions
|
@ -6,9 +6,8 @@ from rwx import ps
|
|||
|
||||
COMMANDS_PREFIX = 'cd-'
|
||||
|
||||
environment = os.environ
|
||||
project = Project(environment)
|
||||
projects = Projects(environment)
|
||||
projects = Projects(os.environ)
|
||||
project = Project(projects)
|
||||
|
||||
|
||||
def cd_clone_branch():
|
||||
|
@ -22,7 +21,7 @@ def cd_clone_branch():
|
|||
|
||||
|
||||
def cd_list_environment():
|
||||
for variable, value in sorted(environment.items()):
|
||||
for variable, value in sorted(os.environ.items()):
|
||||
print(variable, '=', value)
|
||||
|
||||
|
||||
|
|
|
@ -11,12 +11,15 @@ NAME = [
|
|||
|
||||
|
||||
class Project:
|
||||
def __init__(self, environment):
|
||||
def __init__(self, projects):
|
||||
self.projects = projects
|
||||
# branch
|
||||
for variable in BRANCH:
|
||||
if value := environment.get(variable, None):
|
||||
if value := projects.environment.get(variable, None):
|
||||
self.branch = value
|
||||
# name
|
||||
for variable in NAME:
|
||||
if value := environment.get(variable, None):
|
||||
if value := projects.environment.get(variable, None):
|
||||
self.name = path.basename(value)
|
||||
# url
|
||||
self.url = path.join(projects.url, self.name)
|
||||
|
|
|
@ -12,11 +12,12 @@ SERVER_URL = [
|
|||
|
||||
class Projects:
|
||||
def __init__(self, environment):
|
||||
self.environment = environment
|
||||
# group, name
|
||||
for variable in GROUP_AND_NAME:
|
||||
if value := environment.get(variable, None):
|
||||
if value := self.environment.get(variable, None):
|
||||
self.group, self.name = path.split(value)
|
||||
# url
|
||||
for variable in SERVER_URL:
|
||||
if value := environment.get(variable, None):
|
||||
if value := self.environment.get(variable, None):
|
||||
self.url = path.join(value, self.group)
|
||||
|
|
Loading…
Reference in a new issue