From 1137b183e32aae467b08be36d7223172d5d01337 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Fri, 2 Nov 2018 22:49:10 -0700 Subject: commands: rework command categories and arguments - split 'environment' section into 'environments' and 'modules' - move location to 'query packages' section - move cd to developer section - --env-dir no longer has a short optino (was -E) - -E now means "run without an environment" (no longer same as --env-dir) - -D now means "run with this directory environment" - remove short options for may infrequently used top-level commands --- lib/spack/spack/cmd/add.py | 2 +- lib/spack/spack/cmd/cd.py | 2 +- lib/spack/spack/cmd/concretize.py | 2 +- lib/spack/spack/cmd/env.py | 4 ++-- lib/spack/spack/cmd/load.py | 2 +- lib/spack/spack/cmd/location.py | 4 ++-- lib/spack/spack/cmd/mirror.py | 2 +- lib/spack/spack/cmd/module.py | 2 +- lib/spack/spack/cmd/remove.py | 2 +- lib/spack/spack/cmd/unload.py | 2 +- lib/spack/spack/cmd/unuse.py | 2 +- lib/spack/spack/cmd/use.py | 2 +- lib/spack/spack/cmd/view.py | 2 +- lib/spack/spack/main.py | 19 ++++++++++++------- 14 files changed, 27 insertions(+), 22 deletions(-) diff --git a/lib/spack/spack/cmd/add.py b/lib/spack/spack/cmd/add.py index d154a6bc7a..6dc903ae68 100644 --- a/lib/spack/spack/cmd/add.py +++ b/lib/spack/spack/cmd/add.py @@ -12,7 +12,7 @@ import spack.environment as ev description = 'add a spec to an environment' -section = "environment" +section = "environments" level = "long" diff --git a/lib/spack/spack/cmd/cd.py b/lib/spack/spack/cmd/cd.py index 6a10f6f8aa..b2dae30fd8 100644 --- a/lib/spack/spack/cmd/cd.py +++ b/lib/spack/spack/cmd/cd.py @@ -8,7 +8,7 @@ from spack.cmd.common import print_module_placeholder_help import spack.cmd.location description = "cd to spack directories in the shell" -section = "environment" +section = "developer" level = "long" diff --git a/lib/spack/spack/cmd/concretize.py b/lib/spack/spack/cmd/concretize.py index abc6aa57d4..728718e502 100644 --- a/lib/spack/spack/cmd/concretize.py +++ b/lib/spack/spack/cmd/concretize.py @@ -6,7 +6,7 @@ import spack.environment as ev description = 'concretize an environment and write a lockfile' -section = "environment" +section = "environments" level = "long" diff --git a/lib/spack/spack/cmd/env.py b/lib/spack/spack/cmd/env.py index 3403194659..c478f3c412 100644 --- a/lib/spack/spack/cmd/env.py +++ b/lib/spack/spack/cmd/env.py @@ -21,8 +21,8 @@ import spack.environment as ev import spack.util.string as string description = "manage virtual environments" -section = "environment" -level = "long" +section = "environments" +level = "short" #: List of subcommands of `spack env` diff --git a/lib/spack/spack/cmd/load.py b/lib/spack/spack/cmd/load.py index b606af3694..87822edb25 100644 --- a/lib/spack/spack/cmd/load.py +++ b/lib/spack/spack/cmd/load.py @@ -7,7 +7,7 @@ import argparse from spack.cmd.common import print_module_placeholder_help, arguments description = "add package to environment using `module load`" -section = "environment" +section = "modules" level = "short" diff --git a/lib/spack/spack/cmd/location.py b/lib/spack/spack/cmd/location.py index c97075441d..a878f63df8 100644 --- a/lib/spack/spack/cmd/location.py +++ b/lib/spack/spack/cmd/location.py @@ -14,8 +14,8 @@ import spack.environment import spack.paths import spack.repo -description = "print out locations of various directories used by Spack" -section = "environment" +description = "print out locations of packages and spack directories" +section = "basic" level = "long" diff --git a/lib/spack/spack/cmd/mirror.py b/lib/spack/spack/cmd/mirror.py index 5ef153b314..4d70df431b 100644 --- a/lib/spack/spack/cmd/mirror.py +++ b/lib/spack/spack/cmd/mirror.py @@ -20,7 +20,7 @@ from spack.spec import Spec from spack.error import SpackError from spack.util.spack_yaml import syaml_dict -description = "manage mirrors" +description = "manage mirrors (source and binary)" section = "config" level = "long" diff --git a/lib/spack/spack/cmd/module.py b/lib/spack/spack/cmd/module.py index f100293cc0..c71f84ef7d 100644 --- a/lib/spack/spack/cmd/module.py +++ b/lib/spack/spack/cmd/module.py @@ -12,7 +12,7 @@ import spack.cmd.modules.lmod import spack.cmd.modules.tcl description = "manipulate module files" -section = "environment" +section = "modules" level = "short" diff --git a/lib/spack/spack/cmd/remove.py b/lib/spack/spack/cmd/remove.py index 5e4a6e5939..ec0b2cd218 100644 --- a/lib/spack/spack/cmd/remove.py +++ b/lib/spack/spack/cmd/remove.py @@ -12,7 +12,7 @@ import spack.environment as ev description = 'remove specs from an environment' -section = "environment" +section = "environments" level = "long" diff --git a/lib/spack/spack/cmd/unload.py b/lib/spack/spack/cmd/unload.py index 60f72bb989..d8730aea92 100644 --- a/lib/spack/spack/cmd/unload.py +++ b/lib/spack/spack/cmd/unload.py @@ -7,7 +7,7 @@ import argparse from spack.cmd.common import print_module_placeholder_help description = "remove package from environment using `module unload`" -section = "environment" +section = "modules" level = "short" diff --git a/lib/spack/spack/cmd/unuse.py b/lib/spack/spack/cmd/unuse.py index 346fb285ee..4aab78b17b 100644 --- a/lib/spack/spack/cmd/unuse.py +++ b/lib/spack/spack/cmd/unuse.py @@ -7,7 +7,7 @@ import argparse from spack.cmd.common import print_module_placeholder_help description = "remove package from environment using dotkit" -section = "environment" +section = "modules" level = "long" diff --git a/lib/spack/spack/cmd/use.py b/lib/spack/spack/cmd/use.py index 20072c3ef9..80ae80329a 100644 --- a/lib/spack/spack/cmd/use.py +++ b/lib/spack/spack/cmd/use.py @@ -7,7 +7,7 @@ import argparse from spack.cmd.common import print_module_placeholder_help, arguments description = "add package to environment using dotkit" -section = "environment" +section = "modules" level = "long" diff --git a/lib/spack/spack/cmd/view.py b/lib/spack/spack/cmd/view.py index 0d1f8e20cb..9768458f02 100644 --- a/lib/spack/spack/cmd/view.py +++ b/lib/spack/spack/cmd/view.py @@ -43,7 +43,7 @@ import spack.store from spack.filesystem_view import YamlFilesystemView description = "produce a single-rooted directory view of packages" -section = "environment" +section = "environments" level = "short" actions_link = ["symlink", "add", "soft", "hardlink", "hard"] diff --git a/lib/spack/spack/main.py b/lib/spack/spack/main.py index ea1ec0df96..90ac30aaba 100644 --- a/lib/spack/spack/main.py +++ b/lib/spack/spack/main.py @@ -19,6 +19,7 @@ import argparse from six import StringIO import llnl.util.tty as tty +import llnl.util.tty.color as color from llnl.util.tty.log import log_output import spack @@ -324,12 +325,12 @@ def make_argument_parser(**kwargs): help="when to colorize output (default: auto)") parser.add_argument( '-C', '--config-scope', dest='config_scopes', action='append', - metavar='DIRECTORY', help="use an additional configuration scope") + metavar='DIR', help="use an additional configuration scope") parser.add_argument( '-d', '--debug', action='store_true', help="write out debug logs during compile") parser.add_argument( - '-D', '--pdb', action='store_true', + '--pdb', action='store_true', help="run spack under the pdb debugger") env_group = parser.add_mutually_exclusive_group() @@ -337,8 +338,11 @@ def make_argument_parser(**kwargs): '-e', '--env', dest='env', metavar='ENV', action='store', help="run with a specific environment (see spack env)") env_group.add_argument( - '-E', '--env-dir', metavar='DIR', action='store', + '-D', '--env-dir', dest='env_dir', metavar='DIR', action='store', help="run with an environment directory (ignore named environments)") + env_group.add_argument( + '-E', '--no-env', dest='no_env', action='store_true', + help="run without any environments activated (see spack env)") parser.add_argument( '--use-env-repo', action='store_true', help="when running in an environment, use its package repository") @@ -359,7 +363,7 @@ def make_argument_parser(**kwargs): '-p', '--profile', action='store_true', dest='spack_profile', help="profile execution using cProfile") parser.add_argument( - '-P', '--sorted-profile', default=None, metavar="STAT", + '--sorted-profile', default=None, metavar="STAT", help="profile and sort by one or more of:\n[%s]" % ',\n '.join([', '.join(line) for line in stat_lines])) parser.add_argument( @@ -369,7 +373,7 @@ def make_argument_parser(**kwargs): '-v', '--verbose', action='store_true', help="print additional output during builds") parser.add_argument( - '-s', '--stacktrace', action='store_true', + '--stacktrace', action='store_true', help="add stacktraces to all printed statements") parser.add_argument( '-V', '--version', action='store_true', @@ -410,7 +414,7 @@ def setup_main_options(args): spack.config.set('config:verify_ssl', False, scope='command_line') # when to use color (takes always, auto, or never) - tty.color.set_color_when(args.color) + color.set_color_when(args.color) def allows_unknown_args(command): @@ -622,7 +626,8 @@ def main(argv=None): args, unknown = parser.parse_known_args(argv) # activate an environment if one was specified on the command line - activate_environment(args.env, args.env_dir, args.use_env_repo) + if not args.no_env: + activate_environment(args.env, args.env_dir, args.use_env_repo) # make spack.config aware of any command line configuration scopes if args.config_scopes: -- cgit v1.2.3-70-g09d2