mirror of
https://github.com/starship/starship.git
synced 2026-06-23 02:05:51 +07:00
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>
This commit is contained in:
@@ -906,6 +906,7 @@
|
||||
"kubernetes": {
|
||||
"default": {
|
||||
"context_aliases": {},
|
||||
"contexts": [],
|
||||
"detect_extensions": [],
|
||||
"detect_files": [],
|
||||
"detect_folders": [],
|
||||
@@ -4013,6 +4014,58 @@
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"contexts": {
|
||||
"default": [],
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/KubernetesContextConfig"
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"KubernetesContextConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context_pattern": {
|
||||
"default": "",
|
||||
"type": "string"
|
||||
},
|
||||
"user_pattern": {
|
||||
"default": null,
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"symbol": {
|
||||
"default": null,
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"style": {
|
||||
"default": null,
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"context_alias": {
|
||||
"default": null,
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"user_alias": {
|
||||
"default": null,
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
||||
Reference in New Issue
Block a user