1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-05-29 14:40:51 +00:00
starship/src
Jan Katins 6b444e05c6
feat(kubernetes): Add styling based on current context (#4550)
* feat(kubernetes): Add styling based on current context

Add an ability to customize the configuration of the kubernetes module style, based on the current context.

A new variable is added to the config section, called environments, which is a list of possible customizations. Each such customization is an object with a context_pattern regex, which matches context name, and an optional style and icon that will override the global configuration, if the currently used context matched the context_pattern.

Based on multiple attempts to add per-context styling and symbols to the kubernetes module.

- https://github.com/starship/starship/pull/1568 by @lht https://github.com/lht -> base
- https://github.com/starship/starship/pull/614 by @nomaed https://github.com/nomaed -> naming, symbol, some tests

Rebased and combined by @jankatins

Contains the following squasched commits

- Rename to contexts and move aliases into contexts
- Move deprecated functions to a submodule
- Cleanup: ignore None-valued KubeCtxComponents
- Add regex func + clean up matching-context search
- Placate paper clip

Closes: https://github.com/starship/starship/issues/570

Co-authored-by: =?UTF-8?q?Boris=20Aranovic=CC=8C?= <nomaed@gmail.com>
Co-authored-by: Jan Katins <jasc@gmx.net>
Co-authored-by: Kevin Song <chips@ksong.dev>

* refactor(kubernetes): Remove options and use clearer names

* test(kubernetes): Handle duplicated contexts right

* refactor(kubernetes): Cleaner user matching

* fix(kubernetes): Only show warning in case of problems

* feat(kubernetes): Add back alias replacements

* refactor(kubernetes): Cleanup rust usage

---------

Co-authored-by: Haitao Li <lihaitao@gmail.com>
Co-authored-by: =?UTF-8?q?Boris=20Aranovic=CC=8C?= <nomaed@gmail.com>
Co-authored-by: Kevin Song <chips@ksong.dev>
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2023-09-02 09:19:33 +02:00
..
configs feat(kubernetes): Add styling based on current context (#4550) 2023-09-02 09:19:33 +02:00
formatter chore: handle rust 1.72 clippy & fmt changes (#5399) 2023-08-25 22:53:35 +02:00
init perf: Skip unnecessary indirection in starship init zsh (#5322) 2023-08-31 19:08:13 +02:00
modules feat(kubernetes): Add styling based on current context (#4550) 2023-09-02 09:19:33 +02:00
test refactor(Context): set_config method for Context (#5079) 2023-04-24 16:03:47 +02:00
bug_report.rs chore: fix clippy warnings for rust 1.66 (#4715) 2022-12-17 18:01:27 +01:00
config.rs chore: handle rust 1.72 clippy & fmt changes (#5399) 2023-08-25 22:53:35 +02:00
configure.rs chore: fix new clippy lints (#5241) 2023-06-13 17:06:04 -05:00
context_env.rs fix(config): Make print-config not panic without a config (#5001) 2023-04-13 19:29:21 -05:00
context.rs fix(git): prevent core.fsmonitor from executing external commands (#3981) 2023-07-31 21:44:31 +02:00
lib.rs fix(config): Make print-config not panic without a config (#5001) 2023-04-13 19:29:21 -05:00
logger.rs chore: handle rust 1.72 clippy & fmt changes (#5399) 2023-08-25 22:53:35 +02:00
main.rs fix(config): Make print-config not panic without a config (#5001) 2023-04-13 19:29:21 -05:00
module.rs feat(fossil_metrics): add fossil_metrics module (#4874) 2023-09-02 09:19:04 +02:00
print.rs fix(rprompt): remove lprompt modules from $all again (#5067) 2023-07-06 11:32:17 +02:00
segment.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
serde_utils.rs build(deps): update toml crates (#4853) 2023-01-30 23:12:27 +01:00
utils.rs feat(fossil_metrics): add fossil_metrics module (#4874) 2023-09-02 09:19:04 +02:00