parent
80582ddf37
commit
e191f3cc4d
2 changed files with 24 additions and 0 deletions
|
@ -10,6 +10,21 @@ projects = Projects(os.environ)
|
|||
project = Project(projects)
|
||||
|
||||
|
||||
def cd_browse_workspace():
|
||||
print(f'''\
|
||||
{project.root}
|
||||
↓
|
||||
''', end=str())
|
||||
files = []
|
||||
for directory, directories, files in os.walk(project.root):
|
||||
for file in files:
|
||||
absolute_path = os.path.join(directory, file)
|
||||
relative_path = os.path.relpath(absolute_path, start=project.root)
|
||||
files.append(relative_path)
|
||||
for file in files:
|
||||
print(file)
|
||||
|
||||
|
||||
def cd_clone_branch():
|
||||
print(f'''\
|
||||
{project.url}
|
||||
|
@ -32,6 +47,7 @@ def cd_list_environment():
|
|||
def install_commands(path):
|
||||
user = '/usr/local/bin'
|
||||
for command in [
|
||||
'browse-workspace',
|
||||
'clone-branch',
|
||||
'list-environment',
|
||||
]:
|
||||
|
|
|
@ -8,6 +8,10 @@ NAME = [
|
|||
'GITHUB_REPOSITORY',
|
||||
'CI_PROJECT_PATH',
|
||||
]
|
||||
ROOT = [
|
||||
'GITHUB_WORKSPACE',
|
||||
'CI_PROJECT_DIR',
|
||||
]
|
||||
|
||||
|
||||
class Project:
|
||||
|
@ -21,5 +25,9 @@ class Project:
|
|||
for variable in NAME:
|
||||
if value := projects.environment.get(variable, None):
|
||||
self.name = path.basename(value)
|
||||
# root
|
||||
for variable in ROOT:
|
||||
if value := projects.environment.get(variable, None):
|
||||
self.root = value
|
||||
# url
|
||||
self.url = path.join(projects.url, self.name)
|
||||
|
|
Loading…
Reference in a new issue