gh: use structural settings (#2339)
This commit is contained in:
parent
fd2f746016
commit
82c92a18ba
5 changed files with 123 additions and 35 deletions
|
|
@ -4,8 +4,8 @@
|
|||
config = {
|
||||
programs.gh = {
|
||||
enable = true;
|
||||
aliases = { co = "pr checkout"; };
|
||||
editor = "vim";
|
||||
settings.aliases = { co = "pr checkout"; };
|
||||
settings.editor = "vim";
|
||||
};
|
||||
|
||||
test.stubs.gh = { };
|
||||
|
|
@ -14,7 +14,11 @@
|
|||
assertFileExists home-files/.config/gh/config.yml
|
||||
assertFileContent home-files/.config/gh/config.yml ${
|
||||
builtins.toFile "config-file.yml" ''
|
||||
{"aliases":{"co":"pr checkout"},"editor":"vim","git_protocol":"https"}''
|
||||
aliases:
|
||||
co: pr checkout
|
||||
editor: vim
|
||||
git_protocol: https
|
||||
''
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1 +1,4 @@
|
|||
{ gh-config-file = ./config-file.nix; }
|
||||
{
|
||||
gh-config-file = ./config-file.nix;
|
||||
gh-warnings = ./warnings.nix;
|
||||
}
|
||||
|
|
|
|||
35
tests/modules/programs/gh/warnings.nix
Normal file
35
tests/modules/programs/gh/warnings.nix
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{ config, options, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.gh = {
|
||||
enable = true;
|
||||
aliases = { co = "pr checkout"; };
|
||||
editor = "vim";
|
||||
};
|
||||
|
||||
test.stubs.gh = { };
|
||||
|
||||
test.asserts.warnings.expected = [
|
||||
"The option `programs.gh.editor' defined in ${
|
||||
lib.showFiles options.programs.gh.editor.files
|
||||
} has been renamed to `programs.gh.settings.editor'."
|
||||
"The option `programs.gh.aliases' defined in ${
|
||||
lib.showFiles options.programs.gh.aliases.files
|
||||
} has been renamed to `programs.gh.settings.aliases'."
|
||||
];
|
||||
test.asserts.warnings.enable = true;
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/gh/config.yml
|
||||
assertFileContent home-files/.config/gh/config.yml ${
|
||||
builtins.toFile "config-file.yml" ''
|
||||
aliases:
|
||||
co: pr checkout
|
||||
editor: vim
|
||||
git_protocol: https
|
||||
''
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue