k9s: v0.29/v0.30 compatibility

- Add `skins` option for definition of multiple skin files
- Change file extension to ".yaml"
- Deprecate `skin` option (points to `skins.skin`)
This commit is contained in:
Lucas Wagler 2024-01-21 23:17:27 +00:00 committed by GitHub
parent 0021558dba
commit 020399c287
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 212 additions and 59 deletions

View file

@ -1,4 +1,6 @@
{
k9s-example-settings = ./example-settings.nix;
k9s-empty-settings = ./empty-settings.nix;
k9s-deprecated-options = ./deprecated-options.nix;
k9s-partial-skin-settings = ./partial-skin-settings.nix;
}

View file

@ -0,0 +1,31 @@
{ config, lib, options, ... }: {
programs.k9s = {
enable = true;
skin = {
k9s = {
body = {
fgColor = "dodgerblue";
bgColor = "#ffffff";
logoColor = "#0000ff";
};
info = {
fgColor = "lightskyblue";
sectionColor = "steelblue";
};
};
};
};
test.asserts.warnings.enable = true;
test.asserts.warnings.expected = [
"The option `programs.k9s.skin' defined in ${
lib.showFiles options.programs.k9s.skin.files
} has been renamed to `programs.k9s.skins.skin'."
];
nmt.script = ''
assertFileExists home-files/.config/k9s/skins/skin.yaml
assertFileContent \
home-files/.config/k9s/skins/skin.yaml \
${./example-skin-expected.yaml}
'';
}

View file

@ -3,3 +3,5 @@ k9s:
headless: false
maxConnRetry: 5
refreshRate: 2
ui:
skin: default

View file

@ -11,6 +11,7 @@
maxConnRetry = 5;
enableMouse = true;
headless = false;
ui.skin = "default";
};
};
hotkey = {
@ -22,16 +23,31 @@
};
};
};
skin = {
k9s = {
body = {
fgColor = "dodgerblue";
bgColor = "#ffffff";
logoColor = "#0000ff";
skins = {
"default" = {
k9s = {
body = {
fgColor = "dodgerblue";
bgColor = "#ffffff";
logoColor = "#0000ff";
};
info = {
fgColor = "lightskyblue";
sectionColor = "steelblue";
};
};
info = {
fgColor = "lightskyblue";
sectionColor = "steelblue";
};
"alt-skin" = {
k9s = {
body = {
fgColor = "orangered";
bgColor = "#ffffff";
logoColor = "#0000ff";
};
info = {
fgColor = "red";
sectionColor = "mediumvioletred";
};
};
};
};
@ -61,29 +77,33 @@
};
nmt.script = ''
assertFileExists home-files/.config/k9s/config.yml
assertFileExists home-files/.config/k9s/config.yaml
assertFileContent \
home-files/.config/k9s/config.yml \
${./example-config-expected.yml}
assertFileExists home-files/.config/k9s/skin.yml
home-files/.config/k9s/config.yaml \
${./example-config-expected.yaml}
assertFileExists home-files/.config/k9s/skins/default.yaml
assertFileContent \
home-files/.config/k9s/skin.yml \
${./example-skin-expected.yml}
assertFileExists home-files/.config/k9s/hotkey.yml
home-files/.config/k9s/skins/default.yaml \
${./example-skin-expected.yaml}
assertFileExists home-files/.config/k9s/skins/alt-skin.yaml
assertFileContent \
home-files/.config/k9s/hotkey.yml \
${./example-hotkey-expected.yml}
assertFileExists home-files/.config/k9s/aliases.yml
home-files/.config/k9s/skins/alt-skin.yaml \
${./example-skin-expected-alt.yaml}
assertFileExists home-files/.config/k9s/hotkey.yaml
assertFileContent \
home-files/.config/k9s/aliases.yml \
${./example-aliases-expected.yml}
assertFileExists home-files/.config/k9s/plugin.yml
home-files/.config/k9s/hotkey.yaml \
${./example-hotkey-expected.yaml}
assertFileExists home-files/.config/k9s/aliases.yaml
assertFileContent \
home-files/.config/k9s/plugin.yml \
${./example-plugin-expected.yml}
assertFileExists home-files/.config/k9s/views.yml
home-files/.config/k9s/aliases.yaml \
${./example-aliases-expected.yaml}
assertFileExists home-files/.config/k9s/plugin.yaml
assertFileContent \
home-files/.config/k9s/views.yml \
${./example-views-expected.yml}
home-files/.config/k9s/plugin.yaml \
${./example-plugin-expected.yaml}
assertFileExists home-files/.config/k9s/views.yaml
assertFileContent \
home-files/.config/k9s/views.yaml \
${./example-views-expected.yaml}
'';
}

View file

@ -0,0 +1,8 @@
k9s:
body:
bgColor: '#ffffff'
fgColor: orangered
logoColor: '#0000ff'
info:
fgColor: red
sectionColor: mediumvioletred

View file

@ -0,0 +1,7 @@
k9s:
enableMouse: true
headless: false
maxConnRetry: 5
refreshRate: 2
ui:
skin: alt-skin

View file

@ -0,0 +1,53 @@
{ config, ... }:
# When not specified in `programs.k9s.settings.ui.skin`,
# test that the first skin name (alphabetically) is used in the config file
{
programs.k9s = {
enable = true;
settings = {
k9s = {
refreshRate = 2;
maxConnRetry = 5;
enableMouse = true;
headless = false;
};
};
skins = {
"default" = {
k9s = {
body = {
fgColor = "dodgerblue";
bgColor = "#ffffff";
logoColor = "#0000ff";
};
info = {
fgColor = "lightskyblue";
sectionColor = "steelblue";
};
};
};
"alt-skin" = {
k9s = {
body = {
fgColor = "orangered";
bgColor = "#ffffff";
logoColor = "#0000ff";
};
info = {
fgColor = "red";
sectionColor = "mediumvioletred";
};
};
};
};
};
nmt.script = ''
assertFileExists home-files/.config/k9s/config.yaml
assertFileContent \
home-files/.config/k9s/config.yaml \
${./partial-skin-settings-expected.yaml}
'';
}