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