1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-11-24 13:47:38 +00:00
starship/src/modules
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
..
utils feat(fossil): detection of Fossil check-outs in subdirectories (#4910) 2023-04-02 16:37:27 +02:00
aws.rs feat(aws): support aws sso with automatic authentication refresh (#5170) 2023-05-09 07:53:45 +02:00
azure.rs fix: update of presets and default configuration to reflect changes in Nerd Fonts 3.0 (#5162) 2023-05-10 14:36:56 +02:00
battery.rs fix: update of presets and default configuration to reflect changes in Nerd Fonts 3.0 (#5162) 2023-05-10 14:36:56 +02:00
buf.rs fix(buf): broken icon on windows 10 (#4689) 2022-12-09 18:41:59 +09:00
bun.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
c.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
character.rs chore: fix new clippy lints (#5241) 2023-06-13 17:06:04 -05:00
cmake.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
cmd_duration.rs chore: fix clippy warnings for rust 1.67 (#4855) 2023-01-27 18:33:24 +09:00
cobol.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
conda.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
container.rs fix(container): reduce docker, podman and systemd confusion (#4832) 2023-01-22 23:36:42 +01:00
crystal.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
custom.rs feat(custom): add option to check if pwd is in a repo (#4822) 2023-04-02 16:39:45 +02:00
daml.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
dart.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
deno.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
directory.rs refactor(directory): avoid unnecessary string copies (#5313) 2023-07-30 14:32:20 +02:00
docker_context.rs chore: fix new clippy lints (#4557) 2022-11-05 12:40:46 +01:00
dotnet.rs chore: fix new clippy lints (#4557) 2022-11-05 12:40:46 +01:00
elixir.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
elm.rs chore: fix new clippy lints (#4557) 2022-11-05 12:40:46 +01:00
env_var.rs chore: add spell checker to workflows (#4975) 2023-03-22 13:42:46 -05:00
erlang.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
fennel.rs chore: add spell checker to workflows (#4975) 2023-03-22 13:42:46 -05:00
fill.rs feat: add user-defined color palette (#4209) 2022-09-27 23:08:52 +02:00
fossil_branch.rs feat(fossil): detection of Fossil check-outs in subdirectories (#4910) 2023-04-02 16:37:27 +02:00
fossil_metrics.rs feat(fossil_metrics): add fossil_metrics module (#4874) 2023-09-02 09:19:04 +02:00
gcloud.rs feat(gcloud): add detect_env_vars option (#5166) 2023-05-09 07:55:49 +02:00
git_branch.rs chore: fix clippy warnings for rust 1.66 (#4715) 2022-12-17 18:01:27 +01:00
git_commit.rs chore: use updated gitoxide crate names (#4913) 2023-02-21 13:03:17 +09:00
git_metrics.rs fix(git): prevent core.fsmonitor from executing external commands (#3981) 2023-07-31 21:44:31 +02:00
git_state.rs chore: use updated gitoxide crate names (#4913) 2023-02-21 13:03:17 +09:00
git_status.rs fix(git): prevent core.fsmonitor from executing external commands (#3981) 2023-07-31 21:44:31 +02:00
golang.rs feat(golang): adding mod_version variable (#5177) 2023-06-01 21:18:38 +02:00
gradle.rs fix(gradle): add support for unstable Gradle versions (#5021) 2023-03-27 16:41:09 +02:00
guix_shell.rs feat(guix_shell): Initial implementation (#4397) 2022-10-25 07:44:04 +02:00
haskell.rs chore: fix new clippy lints (#4557) 2022-11-05 12:40:46 +01:00
haxe.rs chore: fix clippy warnings for rust 1.66 (#4715) 2022-12-17 18:01:27 +01:00
helm.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
hg_branch.rs feat(fossil): detection of Fossil check-outs in subdirectories (#4910) 2023-04-02 16:37:27 +02:00
hostname.rs chore: fix new clippy lints (#5241) 2023-06-13 17:06:04 -05:00
java.rs fix(java): wrong version number when using Android Studio JDK (#4966) 2023-04-07 15:40:23 +02:00
jobs.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
julia.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
kotlin.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
kubernetes.rs feat(kubernetes): Add styling based on current context (#4550) 2023-09-02 09:19:33 +02:00
line_break.rs feat: Add a fill module to pad out the line (#3029) 2021-09-12 19:59:15 -04:00
localip.rs feat(localip): use reserved remote address (#4648) 2022-12-01 19:51:04 +01:00
lua.rs chore: fix new clippy lints (#4557) 2022-11-05 12:40:46 +01:00
memory_usage.rs chore: fix new clippy lints (#4557) 2022-11-05 12:40:46 +01:00
meson.rs feat(module): Add a meson devenv indicator (#4389) 2022-10-11 18:02:46 +02:00
mod.rs feat(fossil_metrics): add fossil_metrics module (#4874) 2023-09-02 09:19:04 +02:00
nim.rs chore: fix clippy warnings for rust 1.68 (#4983) 2023-03-11 07:23:30 +01:00
nix_shell.rs chore: add spell checker to workflows (#4975) 2023-03-22 13:42:46 -05:00
nodejs.rs feat(nodejs): Add expected_version variable (#5081) 2023-06-01 21:24:11 +02:00
ocaml.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
opa.rs feat: Open Policy Agent module (#1740) (#4441) 2022-10-15 18:15:33 +02:00
openstack.rs chore: fix new clippy lints (#4557) 2022-11-05 12:40:46 +01:00
os.rs fix: update of presets and default configuration to reflect changes in Nerd Fonts 3.0 (#5162) 2023-05-10 14:36:56 +02:00
package.rs chore: handle rust 1.72 clippy & fmt changes (#5399) 2023-08-25 22:53:35 +02:00
perl.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
php.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
pijul_channel.rs build(deps): update toml crates (#4853) 2023-01-30 23:12:27 +01:00
pulumi.rs chore: fix new clippy lints (#5241) 2023-06-13 17:06:04 -05:00
purescript.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
python.rs build(deps): update toml crates (#4853) 2023-01-30 23:12:27 +01:00
raku.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
red.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
rlang.rs chore: fix new clippy lints (#4557) 2022-11-05 12:40:46 +01:00
ruby.rs chore: fix new clippy lints (#4557) 2022-11-05 12:40:46 +01:00
rust.rs fix(config): Make print-config not panic without a config (#5001) 2023-04-13 19:29:21 -05:00
scala.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
shell.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
shlvl.rs feat(shlvl): add repeat_offset for repeated symbol (#5289) 2023-07-14 10:59:02 +02:00
singularity.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
solidity.rs feat: Add Solidity Module (#5047) 2023-04-13 21:05:12 +02:00
spack.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
status.rs docs(preset): Plaintext status added (#4775) 2022-12-31 12:35:28 +01:00
sudo.rs chore: fix new clippy lints (#4557) 2022-11-05 12:40:46 +01:00
swift.rs chore: fix typos (#5239) 2023-06-13 15:40:17 -05:00
terraform.rs chore: fix new clippy lints (#4557) 2022-11-05 12:40:46 +01:00
time.rs chore: handle rust 1.72 clippy & fmt changes (#5399) 2023-08-25 22:53:35 +02:00
username.rs feat(username): Detect Admin access in Windows (#2791) 2022-04-01 17:47:49 +02:00
vagrant.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
vcsh.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
vlang.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
zig.rs refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00