Skip to content
Snippets Groups Projects
Commit b2caebe8 authored by Hans Fangohr's avatar Hans Fangohr
Browse files

Merge branch 'review-argument-parsing' into 'linux-debian11'

Review command line argument parsing

See merge request mpsd-cs/mpsd-software-environments!7
parents 263947a9 9bba6997
No related branches found
No related tags found
2 merge requests!19Move linux-debian11 into main,!7Review command line argument parsing
Pipeline #367932 passed
...@@ -335,11 +335,15 @@ def install_environment( ...@@ -335,11 +335,15 @@ def install_environment(
def remove_environment(release, toolchains, target_dir): def remove_environment(release, toolchains, target_dir):
print(f"Removing release {release} with toolchains {toolchains} from {target_dir}") msg = f"Removing release {release} with toolchains {toolchains} from {target_dir}"
print(msg)
raise NotImplementedError(msg)
def start_new_environment(release, from_release, target_dir): def start_new_environment(release, from_release, target_dir):
print(f"Starting new release {release} from {from_release} to {target_dir}") msg = f"Starting new release {release} from {from_release} to {target_dir}"
print(msg)
raise NotImplementedError(msg)
def main(): def main():
...@@ -376,9 +380,20 @@ def main(): ...@@ -376,9 +380,20 @@ def main():
else: else:
subp.add_argument( subp.add_argument(
"release", type=str, help="Release version to install or remove" "release",
type=str,
help="Release version to prepare, install, reinstall or remove",
) )
if cmd in ["install", "reinstall"]: if cmd in ["install", "reinstall", "remove"]:
# "install" command needs additional documentation
tool_chain_help = (
f"Pass a list of toolchains to command {cmd}. "
"Use '--toolchains ALL' to "
f"{cmd} all toolchains. If '--toolchain' is not "
"specified, list available toolchains for the release "
"(after environment has been prepared if not done yet)."
)
subp.add_argument( subp.add_argument(
"--toolchains", # first option defines attribute "--toolchains", # first option defines attribute
# name `args.toolchains` in `args = parser_args()` # name `args.toolchains` in `args = parser_args()`
...@@ -388,19 +403,14 @@ def main(): ...@@ -388,19 +403,14 @@ def main():
dest="toolchains", dest="toolchains",
nargs="+", nargs="+",
default="NONE", default="NONE",
help=( help=tool_chain_help,
"List of toolchains to install (use '--toolchains ALL' to "
"install all toolchains). If nothing is specified, list of"
"available toolchains for the release would be shown after"
"creating the environment."
),
) )
subp.add_argument( subp.add_argument(
"--enable-build-cache", "--enable-build-cache",
action="store_true", action="store_true",
help=( help=(
"Enable Spack build cache. Useful for reinstallation but" "Enable Spack build cache. Useful for reinstallation but "
"consumes time and disk space" "consumes time and disk space."
), ),
) )
# Carry out the action # Carry out the action
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment