1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

git: add extraArgs option for difftastic

This option will cover any other arguments that aren't made available
with dedicated options.
This commit is contained in:
Brian Lyles 2025-10-02 23:53:56 -05:00 committed by Austin Horstman
parent 1652349e57
commit 7d3d323e90
3 changed files with 28 additions and 9 deletions

View file

@ -377,6 +377,18 @@ in
Determines how the output displays - in one column or two columns.
'';
};
extraArgs = mkOption {
type = types.nullOr (types.listOf types.str);
default = null;
example = [
"--tab-width=8"
"--sort-paths"
];
description = ''
Extra command line arguments to pass to {command}`difft`.
'';
};
};
delta = {
@ -837,13 +849,16 @@ in
(
let
difftCommand = concatStringsSep " " [
"${lib.getExe cfg.difftastic.package}"
"--color ${cfg.difftastic.color}"
"--background ${cfg.difftastic.background}"
"--display ${cfg.difftastic.display}"
"--context ${toString cfg.difftastic.context}"
];
difftCommand = concatStringsSep " " (
[
"${lib.getExe cfg.difftastic.package}"
"--color ${cfg.difftastic.color}"
"--background ${cfg.difftastic.background}"
"--display ${cfg.difftastic.display}"
"--context ${toString cfg.difftastic.context}"
]
++ (lib.optionals (cfg.difftastic.extraArgs != null) cfg.difftastic.extraArgs)
);
in
(lib.mkMerge [
(mkIf cfg.difftastic.enable {

View file

@ -1,9 +1,9 @@
[diff]
external = "@difftastic@/bin/difft --color always --background dark --display inline --context 5"
external = "@difftastic@/bin/difft --color always --background dark --display inline --context 5 --tab-width=8 --sort-paths"
tool = "difftastic"
[difftool "difftastic"]
cmd = "@difftastic@/bin/difft --color always --background dark --display inline --context 5 $LOCAL $REMOTE"
cmd = "@difftastic@/bin/difft --color always --background dark --display inline --context 5 --tab-width=8 --sort-paths $LOCAL $REMOTE"
[gpg]
format = "openpgp"

View file

@ -9,6 +9,10 @@
color = "always";
context = 5;
display = "inline";
extraArgs = [
"--tab-width=8"
"--sort-paths"
];
};
};