summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/docs/basic_usage.rst8
-rw-r--r--lib/spack/spack/main.py3
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/spack/docs/basic_usage.rst b/lib/spack/docs/basic_usage.rst
index a8a45b65cb..db69ba42e9 100644
--- a/lib/spack/docs/basic_usage.rst
+++ b/lib/spack/docs/basic_usage.rst
@@ -27,12 +27,18 @@ It is recommended that the following be put in your ``.bashrc`` file:
If you do not see colorized output when using ``less -R`` it is because color
is being disabled in the piped output. In this case, tell spack to force
-colorized output.
+colorized output with a flag
.. code-block:: console
$ spack --color always | less -R
+or an environment variable
+
+.. code-block:: console
+
+ $ SPACK_COLOR=always spack | less -R
+
--------------------------
Listing available packages
--------------------------
diff --git a/lib/spack/spack/main.py b/lib/spack/spack/main.py
index be07aa3e5c..ecaf6d02f0 100644
--- a/lib/spack/spack/main.py
+++ b/lib/spack/spack/main.py
@@ -354,7 +354,8 @@ def make_argument_parser(**kwargs):
dest='help', action='store_const', const='long', default=None,
help="show help for all commands (same as spack help --all)")
parser.add_argument(
- '--color', action='store', default='auto',
+ '--color', action='store',
+ default=os.environ.get('SPACK_COLOR', 'auto'),
choices=('always', 'never', 'auto'),
help="when to colorize output (default: auto)")
parser.add_argument(