Read colorization from environment variable, if command line is not set (#23130)
This commit is contained in:
parent
9faa3221b3
commit
3f4c9aeca7
@ -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
|
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
|
is being disabled in the piped output. In this case, tell spack to force
|
||||||
colorized output.
|
colorized output with a flag
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
$ spack --color always | less -R
|
$ spack --color always | less -R
|
||||||
|
|
||||||
|
or an environment variable
|
||||||
|
|
||||||
|
.. code-block:: console
|
||||||
|
|
||||||
|
$ SPACK_COLOR=always spack | less -R
|
||||||
|
|
||||||
--------------------------
|
--------------------------
|
||||||
Listing available packages
|
Listing available packages
|
||||||
--------------------------
|
--------------------------
|
||||||
|
@ -354,7 +354,8 @@ def make_argument_parser(**kwargs):
|
|||||||
dest='help', action='store_const', const='long', default=None,
|
dest='help', action='store_const', const='long', default=None,
|
||||||
help="show help for all commands (same as spack help --all)")
|
help="show help for all commands (same as spack help --all)")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--color', action='store', default='auto',
|
'--color', action='store',
|
||||||
|
default=os.environ.get('SPACK_COLOR', 'auto'),
|
||||||
choices=('always', 'never', 'auto'),
|
choices=('always', 'never', 'auto'),
|
||||||
help="when to colorize output (default: auto)")
|
help="when to colorize output (default: auto)")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
Loading…
Reference in New Issue
Block a user