* feat(k8s): Add detect env vars option
Have added the option to trigger the k8s module based on what env vars
are set, this has been done in a backwards compatible way so if nothing
is changed from the defaults the module will still behave the same way
as before. This is similar to what I did in #4486 for the python module
and if goes well I'd like to rollout to other modules.
* Update src/modules/kubernetes.rs
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
* Update src/modules/kubernetes.rs
---------
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
* combine ANSI color codes before wrapping them
The existing code wraps each individual module's output for
`context.shell`, concatenates all that output together and passes it to
`AnsiStrings` to merge ANSI color codes. However, the wrapping obscures
ANSI color codes, meaning that no merging is possible.
This commit changes the shell-specific wrapping to happen right before
output, once all modules' output has been concatenated together. This
results in ANSI color codes being correctly merged, as well as reducing
the number of calls to `wrap_colorseq_for_shell` to one.
With a minimal `starship.toml`:
```
format = """$directory"""
[directory]
format = '[a]($style)[b]($style)'
```
The current code produces[0]:
```
\n%{\x1b[31m%}a%{\x1b[0m%}%{\x1b[31m%}b%{\x1b[0m%
```
And this commit's code:
```
\n%{\x1b[31m%}ab%{\x1b[0m%}
```
You can see that the current code emits an additional reset and repeated
color code between "a" and "b" compared to the new code.
[0] Produced in a Python shell with:
```
subprocess.check_output(
"./target/debug/starship prompt", shell=True,
env={"STARSHIP_CONFIG": "./starship.toml", "STARSHIP_SHELL": "zsh"}
)
```
* utils: return early from wrap_seq_for_shell unless wrapping required
* refactor(utils): simplify wrap_seq_for_shell
This commit modifies wrap_seq_for_shell to (a) return early for shells
with no wrapping required, and (b) determine the wrapping characters
once at the start of the function (rather than inline in the map
function for every character).
* Create place to put it in the config
* Initial functional version
* Fix grammar
* Add option documentation to README
* Add test for two aliases and emoji translation
* Remove println
* Rewrite match as iflet
* Improve converting the reference
* Format file
* Try to restore autoformat of markdown
* Replace toml:Map with concrete IndexMap
* Update schema
* Add option that got lost
* Add Odin lang module
* add utils string and remove commit number from output
* switch to new symbol because ZWJ support is rare
* add config docs
* add option to show the commit number
* fix lack of trimming
* fix formatting to comply with checks
* Add trailing newline to comply with cargo fmt
* Add new Odin test and add newline in cmd output
Resolve #5847 by initializing `$env.STARSHIP_SHELL` before calling `starship`
Most minimal change possible. Other simplification are possible but not know to be
backwards compatible. Also considered `with-env` or `STARSHIP_SHELL=nu starship` but
they'd be worse. Happy to reformat indentation if desired.
* Added the option "detect_env_vars" to the `username` module
with the same functionality as in the `hostname` module.
* Fixed logic error and added test to catch it
* build(deps): update dependency vitepress to ^1.0.0-rc.45
* build(deps): update rust crate shadow-rs to 0.27.1
* Added the option "detect_env_vars" to the `username` module
with the same functionality as in the `hostname` module.
* Fixed logic error and added test to catch it
* Removed unused gix import
* Removed unused gix import, again
* Removed unused gix import. Next try
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* feat(docs): move to vitepress
* change up hero styles to match existing site
* A bit more style tweaking
* Replace stylus with plain CSS
* improve unicode-range value for nerdfont
---------
Co-authored-by: Matan Kushner <hello@matchai.dev>
* Support right prompt in bash
* Docs for transience in bash
* Apply suggestions from review
* Simplify conditional
* Use ble.sh hooks, if available
* Properly quote args
* Use BLE_PIPESTATUS
* Update starship.bash
* Update src/init/starship.bash
Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
---------
Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
* update AllowStatus to work with direnv 2.33
direnv now returns int enum instead of boolean, https://github.com/direnv/direnv/pull/1158
* update schema
* maybe fixed the schema now
* Whoops, I inverted the flags somehow
* have coffee, fix mistaken understanding
* undo changes to tranlations
* Update docs/config/README.md
* Update src/modules/direnv.rs
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
* update test output
---------
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
* do not detect R for .Rprofile files, closes #2817
* get R package version, #5586
* update schema
* fix and simplify regex for rlang package version
* attempt to fix regex
* proper detect R packages, closes #5590
* reduce diff vs master branch
* Added hostname.detect_env_vars
based on the newly added context::detect_env_vars
- extended context::detect_env_vars to check for negated environment
variables as well, analogous to the other detect modules
- made hostname.detect_env_vars only active if ssh_only is set to false
for backwards compatibility
Co-authored-by: Dominik Sander <dsander@users.noreply.github.com>
* added clippy recommendations, removed unneeded comments
* Added new logic (suggested in https://github.com/starship/starship/pull/5196#issuecomment-1566228913)
The new `detect_env_vars` now requires either SSH_ONLY to be false or the
environment variable SSH_CONNECTION to be set, so that is will be used
* Fixed typo
* Refactored the detect_env_vars function for early returns and better readability
* Change boolean logic for better readability
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
* Apply suggestions from code review to `detect_env_vars` method.
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
* Fixed bracket error & updated comments
- fixed bracket error in hostname.rs, after changes
- updated comments for context.rs, for the suggested changes
* Removed obsolete warning from docs/config/README.md
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
---------
Co-authored-by: Dominik Sander <dsander@users.noreply.github.com>
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>