spack/lib/spack
Todd Gamblin 379eeda576
shell: fix zsh color formatting for PS1 in environments (#39497)
* shell: fix zsh color formatting for PS1 in environments

The `colorize` function in `llnl.util.tty.color` only applies proper formatting for Bash
ANSI and for console output, but this is not what zsh expects for environment variables.

In particular, when using `zsh`, `spack env activate -p` produces a `PS1` prompt that
looks like this:

```
\[\033[0;92m\][ENVIRONMENT]\[\033[0m\]
```

For zsh the formatting should be:

```
\e[0;92m[ENVIRONMENT]\e0;m
```

- [x] Add a `zsh` option to `colorize()` to enable zsh color formatting
- [x] Add conditional to choose the right `PS1` for `zsh`, `bash`, and `sh`
- [x] Don't use color escapes for `sh`, as they don't print properly

* convert lots of += lines to triple quotes
2023-12-28 15:36:30 -08:00
..
docs build(deps): bump black from 23.12.0 to 23.12.1 in /lib/spack/docs (#41852) 2023-12-28 10:26:31 +01:00
env cc: Ensure that user-specified flags take precedence over others (#37376) 2023-06-18 14:07:08 -07:00
external archspec: update to v0.2.2 (#40917) 2023-11-07 07:44:52 +01:00
llnl shell: fix zsh color formatting for PS1 in environments (#39497) 2023-12-28 15:36:30 -08:00
spack shell: fix zsh color formatting for PS1 in environments (#39497) 2023-12-28 15:36:30 -08:00
spack_installable Consolidate definition of Spack's extra sys.path components (#41816) 2023-12-21 16:25:12 -08:00