gh: use structural settings (#2339)

This commit is contained in:
Nicolas Berbiche 2021-10-08 23:29:25 +02:00 committed by GitHub
parent fd2f746016
commit 82c92a18ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 123 additions and 35 deletions

View file

@ -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
''
}
'';
};

View file

@ -1 +1,4 @@
{ gh-config-file = ./config-file.nix; }
{
gh-config-file = ./config-file.nix;
gh-warnings = ./warnings.nix;
}

View 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
''
}
'';
};
}