mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 11:36:05 +01:00
diff-so-fancy: use freeform settings option
Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
bb7bb23583
commit
85cd07b8b0
4 changed files with 70 additions and 90 deletions
|
|
@ -18,36 +18,43 @@ in
|
||||||
{
|
{
|
||||||
meta.maintainers = with lib.maintainers; [ khaneliman ];
|
meta.maintainers = with lib.maintainers; [ khaneliman ];
|
||||||
|
|
||||||
imports = [
|
imports =
|
||||||
(lib.mkRenamedOptionModule
|
let
|
||||||
[ "programs" "git" "diff-so-fancy" "enable" ]
|
oldPrefix = [
|
||||||
[ "programs" "diff-so-fancy" "enable" ]
|
"programs"
|
||||||
)
|
"diff-so-fancy"
|
||||||
(lib.mkRenamedOptionModule
|
];
|
||||||
[ "programs" "git" "diff-so-fancy" "pagerOpts" ]
|
newPrefix = [
|
||||||
[ "programs" "diff-so-fancy" "pagerOpts" ]
|
"programs"
|
||||||
)
|
"diff-so-fancy"
|
||||||
(lib.mkRenamedOptionModule
|
"settings"
|
||||||
[ "programs" "git" "diff-so-fancy" "markEmptyLines" ]
|
];
|
||||||
[ "programs" "diff-so-fancy" "markEmptyLines" ]
|
renamedOptions = [
|
||||||
)
|
"markEmptyLines"
|
||||||
(lib.mkRenamedOptionModule
|
"changeHunkIndicators"
|
||||||
[ "programs" "git" "diff-so-fancy" "changeHunkIndicators" ]
|
"stripLeadingSymbols"
|
||||||
[ "programs" "diff-so-fancy" "changeHunkIndicators" ]
|
"useUnicodeRuler"
|
||||||
)
|
"rulerWidth"
|
||||||
(lib.mkRenamedOptionModule
|
];
|
||||||
[ "programs" "git" "diff-so-fancy" "stripLeadingSymbols" ]
|
in
|
||||||
[ "programs" "diff-so-fancy" "stripLeadingSymbols" ]
|
[
|
||||||
)
|
(lib.mkRenamedOptionModule
|
||||||
(lib.mkRenamedOptionModule
|
[ "programs" "git" "diff-so-fancy" "enable" ]
|
||||||
[ "programs" "git" "diff-so-fancy" "useUnicodeRuler" ]
|
[ "programs" "diff-so-fancy" "enable" ]
|
||||||
[ "programs" "diff-so-fancy" "useUnicodeRuler" ]
|
)
|
||||||
)
|
(lib.mkRenamedOptionModule
|
||||||
(lib.mkRenamedOptionModule
|
[ "programs" "git" "diff-so-fancy" "pagerOpts" ]
|
||||||
[ "programs" "git" "diff-so-fancy" "rulerWidth" ]
|
[ "programs" "diff-so-fancy" "pagerOpts" ]
|
||||||
[ "programs" "diff-so-fancy" "rulerWidth" ]
|
)
|
||||||
)
|
]
|
||||||
];
|
++ (lib.hm.deprecations.mkSettingsRenamedOptionModules oldPrefix newPrefix {
|
||||||
|
transform = x: x;
|
||||||
|
} renamedOptions)
|
||||||
|
++ (lib.hm.deprecations.mkSettingsRenamedOptionModules [
|
||||||
|
"programs"
|
||||||
|
"git"
|
||||||
|
"diff-so-fancy"
|
||||||
|
] newPrefix { transform = x: x; } renamedOptions);
|
||||||
|
|
||||||
options.programs.diff-so-fancy = {
|
options.programs.diff-so-fancy = {
|
||||||
enable = mkEnableOption "diff-so-fancy, a diff colorizer";
|
enable = mkEnableOption "diff-so-fancy, a diff colorizer";
|
||||||
|
|
@ -63,53 +70,28 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
markEmptyLines = mkOption {
|
settings = mkOption {
|
||||||
type = types.bool;
|
type =
|
||||||
default = true;
|
with types;
|
||||||
example = false;
|
let
|
||||||
|
primitiveType = oneOf [
|
||||||
|
str
|
||||||
|
bool
|
||||||
|
int
|
||||||
|
];
|
||||||
|
in
|
||||||
|
attrsOf primitiveType;
|
||||||
|
default = { };
|
||||||
|
example = {
|
||||||
|
markEmptyLines = true;
|
||||||
|
changeHunkIndicators = true;
|
||||||
|
stripLeadingSymbols = true;
|
||||||
|
useUnicodeRuler = true;
|
||||||
|
rulerWidth = 80;
|
||||||
|
};
|
||||||
description = ''
|
description = ''
|
||||||
Whether the first block of an empty line should be colored.
|
Options to configure diff-so-fancy. See
|
||||||
'';
|
<https://github.com/so-fancy/diff-so-fancy#configuration> for available options.
|
||||||
};
|
|
||||||
|
|
||||||
changeHunkIndicators = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = true;
|
|
||||||
example = false;
|
|
||||||
description = ''
|
|
||||||
Simplify git header chunks to a more human readable format.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
stripLeadingSymbols = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = true;
|
|
||||||
example = false;
|
|
||||||
description = ''
|
|
||||||
Whether the `+` or `-` at
|
|
||||||
line-start should be removed.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
useUnicodeRuler = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = true;
|
|
||||||
example = false;
|
|
||||||
description = ''
|
|
||||||
By default, the separator for the file header uses Unicode
|
|
||||||
line-drawing characters. If this is causing output errors on
|
|
||||||
your terminal, set this to false to use ASCII characters instead.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
rulerWidth = mkOption {
|
|
||||||
type = types.nullOr types.int;
|
|
||||||
default = null;
|
|
||||||
example = false;
|
|
||||||
description = ''
|
|
||||||
By default, the separator for the file header spans the full
|
|
||||||
width of the terminal. Use this setting to set the width of
|
|
||||||
the file header manually.
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -155,13 +137,7 @@ in
|
||||||
{
|
{
|
||||||
core.pager = "${dsfCommand} | ${pkgs.less}/bin/less ${lib.escapeShellArgs cfg.pagerOpts}";
|
core.pager = "${dsfCommand} | ${pkgs.less}/bin/less ${lib.escapeShellArgs cfg.pagerOpts}";
|
||||||
interactive.diffFilter = "${dsfCommand} --patch";
|
interactive.diffFilter = "${dsfCommand} --patch";
|
||||||
diff-so-fancy = {
|
diff-so-fancy = cfg.settings;
|
||||||
markEmptyLines = cfg.markEmptyLines;
|
|
||||||
changeHunkIndicators = cfg.changeHunkIndicators;
|
|
||||||
stripLeadingSymbols = cfg.stripLeadingSymbols;
|
|
||||||
useUnicodeRuler = cfg.useUnicodeRuler;
|
|
||||||
rulerWidth = mkIf (cfg.rulerWidth != null) cfg.rulerWidth;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
{
|
{
|
||||||
programs.diff-so-fancy = {
|
programs.diff-so-fancy = {
|
||||||
enable = true;
|
enable = true;
|
||||||
markEmptyLines = false;
|
settings = {
|
||||||
changeHunkIndicators = true;
|
markEmptyLines = false;
|
||||||
|
changeHunkIndicators = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
programs.git.enable = true;
|
programs.git.enable = true;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
test.asserts.warnings.expected = [
|
test.asserts.warnings.expected = [
|
||||||
"The option `programs.git.diff-so-fancy.changeHunkIndicators' defined in ${lib.showFiles options.programs.git.diff-so-fancy.changeHunkIndicators.files} has been renamed to `programs.diff-so-fancy.changeHunkIndicators'."
|
"The option `programs.git.diff-so-fancy.changeHunkIndicators' defined in ${lib.showFiles options.programs.git.diff-so-fancy.changeHunkIndicators.files} has been renamed to `programs.diff-so-fancy.settings.changeHunkIndicators'."
|
||||||
"The option `programs.git.diff-so-fancy.markEmptyLines' defined in ${lib.showFiles options.programs.git.diff-so-fancy.markEmptyLines.files} has been renamed to `programs.diff-so-fancy.markEmptyLines'."
|
"The option `programs.git.diff-so-fancy.markEmptyLines' defined in ${lib.showFiles options.programs.git.diff-so-fancy.markEmptyLines.files} has been renamed to `programs.diff-so-fancy.settings.markEmptyLines'."
|
||||||
"The option `programs.git.diff-so-fancy.enable' defined in ${lib.showFiles options.programs.git.diff-so-fancy.enable.files} has been renamed to `programs.diff-so-fancy.enable'."
|
"The option `programs.git.diff-so-fancy.enable' defined in ${lib.showFiles options.programs.git.diff-so-fancy.enable.files} has been renamed to `programs.diff-so-fancy.enable'."
|
||||||
"`programs.diff-so-fancy.enableGitIntegration` automatic enablement is deprecated. Please explicitly set `programs.diff-so-fancy.enableGitIntegration = true`."
|
"`programs.diff-so-fancy.enableGitIntegration` automatic enablement is deprecated. Please explicitly set `programs.diff-so-fancy.enableGitIntegration = true`."
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,11 @@
|
||||||
programs.diff-so-fancy = {
|
programs.diff-so-fancy = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableGitIntegration = true;
|
enableGitIntegration = true;
|
||||||
markEmptyLines = false;
|
settings = {
|
||||||
changeHunkIndicators = true;
|
markEmptyLines = false;
|
||||||
stripLeadingSymbols = false;
|
changeHunkIndicators = true;
|
||||||
|
stripLeadingSymbols = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.git.enable = true;
|
programs.git.enable = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue