Skip to content

Commit

Permalink
Add `--all' option to open all yaml files
Browse files Browse the repository at this point in the history
Adds `--all` to open all yaml files in workspace config directory.
  • Loading branch information
dapomeroy committed Dec 19, 2024
1 parent 59f8cc2 commit 6b050e3
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
10 changes: 10 additions & 0 deletions lib/ramble/ramble/cmd/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,14 @@ def workspace_edit_setup_parser(subparser):
required=False,
)

subparser.add_argument(
"--all",
dest="all_config",
action="store_true",
help="Open all yaml files in workspace config directory",
required=False,
)

subparser.add_argument(
"-t",
"--template_only",
Expand Down Expand Up @@ -930,6 +938,8 @@ def workspace_edit(args):
edit_files = [modifiers_file]
elif args.software_only:
edit_files = [software_file]
elif args.all_config:
edit_files = ramble.workspace.all_config_files(ramble_ws)
elif args.template_only:
edit_files = template_files
elif args.license_only:
Expand Down
2 changes: 2 additions & 0 deletions lib/ramble/ramble/workspace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
modifiers_file_name,
software_file,
software_file_name,
all_config_files,
licenses_file,
licenses_file_name,
metadata_file_name,
Expand Down Expand Up @@ -84,6 +85,7 @@
"modifiers_file_name",
"software_file",
"software_file_name",
"all_config_files",
"licenses_file",
"licenses_file_name",
"metadata_file_name",
Expand Down
12 changes: 12 additions & 0 deletions lib/ramble/ramble/workspace/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,18 @@ def licenses_file(path):
return get_yaml_filepath(path, licenses_file_name)


def all_config_files(path):
"""Returns path to all yaml files in workspace config directory"""
config_files = []

config_path = os.path.join(path, workspace_config_path)
for f in os.listdir(config_path):
if f.endswith(".yaml"):
config_files.append(os.path.join(config_path, f))

return config_files


def template_path(ws_path, requested_template_name):
"""Returns the path to a workspace's template file"""
config_path = os.path.join(ws_path, workspace_config_path)
Expand Down
2 changes: 1 addition & 1 deletion share/ramble/ramble-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ _ramble_workspace_info() {
}

_ramble_workspace_edit() {
RAMBLE_COMPREPLY="-h --help -c --config_only -a --applications_only -m --modifiers_only -s --software_only -t --template_only -l --license_only -p --print-file"
RAMBLE_COMPREPLY="-h --help -c --config_only -a --applications_only -m --modifiers_only -s --software_only --all -t --template_only -l --license_only -p --print-file"
}

_ramble_workspace_mirror() {
Expand Down

0 comments on commit 6b050e3

Please sign in to comment.