diff options
author | Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com> | 2023-10-31 23:08:46 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-01 00:08:46 -0600 |
commit | f5d717cd5a6f556a0fee6c1dffdc2e29b15f138a (patch) | |
tree | e378566f9bf435f3c4605d1a05ffd6196cce5614 | |
parent | cb018fd7ebbc8d895208c1cbdfdd277ae99d6a0d (diff) | |
download | spack-f5d717cd5a6f556a0fee6c1dffdc2e29b15f138a.tar.gz spack-f5d717cd5a6f556a0fee6c1dffdc2e29b15f138a.tar.bz2 spack-f5d717cd5a6f556a0fee6c1dffdc2e29b15f138a.tar.xz spack-f5d717cd5a6f556a0fee6c1dffdc2e29b15f138a.zip |
Fix env remove indentation (#40811)
-rw-r--r-- | lib/spack/spack/cmd/env.py | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/lib/spack/spack/cmd/env.py b/lib/spack/spack/cmd/env.py index 4ca98dcdcc..490538694b 100644 --- a/lib/spack/spack/cmd/env.py +++ b/lib/spack/spack/cmd/env.py @@ -388,27 +388,25 @@ def env_remove(args): except spack.config.ConfigFormatError: bad_envs.append(env_name) - if not args.yes_to_all: - environments = string.plural(len(args.rm_env), "environment", show_n=False) - envs = string.comma_and(args.rm_env) - answer = tty.get_yes_or_no(f"Really remove {environments} {envs}?", default=False) - if not answer: - tty.die("Will not remove any environments") - - for env in read_envs: - name = env.name - if env.active: - tty.die(f"Environment {name} can't be removed while activated.") - env.destroy() - tty.msg(f"Successfully removed environment {name}") - - for bad_env_name in bad_envs: - shutil.rmtree( - spack.environment.environment.environment_dir_from_name( - bad_env_name, exists_ok=True - ) - ) - tty.msg(f"Successfully removed environment '{bad_env_name}'") + if not args.yes_to_all: + environments = string.plural(len(args.rm_env), "environment", show_n=False) + envs = string.comma_and(args.rm_env) + answer = tty.get_yes_or_no(f"Really remove {environments} {envs}?", default=False) + if not answer: + tty.die("Will not remove any environments") + + for env in read_envs: + name = env.name + if env.active: + tty.die(f"Environment {name} can't be removed while activated.") + env.destroy() + tty.msg(f"Successfully removed environment '{name}'") + + for bad_env_name in bad_envs: + shutil.rmtree( + spack.environment.environment.environment_dir_from_name(bad_env_name, exists_ok=True) + ) + tty.msg(f"Successfully removed environment '{bad_env_name}'") # |