parent
e0c70942c0
commit
7413408b04
4 changed files with 98 additions and 3 deletions
|
|
@ -2,4 +2,6 @@
|
|||
yazi-settings = ./settings.nix;
|
||||
yazi-bash-integration-enabled = ./bash-integration-enabled.nix;
|
||||
yazi-zsh-integration-enabled = ./zsh-integration-enabled.nix;
|
||||
yazi-fish-integration-enabled = ./fish-integration-enabled.nix;
|
||||
yazi-nushell-integration-enabled = ./nushell-integration-enabled.nix;
|
||||
}
|
||||
|
|
|
|||
27
tests/modules/programs/yazi/fish-integration-enabled.nix
Normal file
27
tests/modules/programs/yazi/fish-integration-enabled.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{ ... }:
|
||||
|
||||
let
|
||||
shellIntegration = ''
|
||||
function ya
|
||||
set tmp (mktemp -t "yazi-cwd.XXXXX")
|
||||
yazi --cwd-file="$tmp"
|
||||
if set cwd (cat -- "$tmp") && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]
|
||||
cd -- "$cwd"
|
||||
end
|
||||
rm -f -- "$tmp"
|
||||
end
|
||||
'';
|
||||
in {
|
||||
programs.fish.enable = true;
|
||||
|
||||
programs.yazi = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
};
|
||||
|
||||
test.stubs.yazi = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContains home-files/.config/fish/config.fish '${shellIntegration}'
|
||||
'';
|
||||
}
|
||||
33
tests/modules/programs/yazi/nushell-integration-enabled.nix
Normal file
33
tests/modules/programs/yazi/nushell-integration-enabled.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
shellIntegration = ''
|
||||
def-env ya [] {
|
||||
let tmp = (mktemp -t "yazi-cwd.XXXXX")
|
||||
yazi --cwd-file $tmp
|
||||
let cwd = (cat -- $tmp)
|
||||
if $cwd != "" and $cwd != $env.PWD {
|
||||
cd $cwd
|
||||
}
|
||||
rm -f $tmp
|
||||
}
|
||||
'';
|
||||
in {
|
||||
programs.nushell.enable = true;
|
||||
|
||||
programs.yazi = {
|
||||
enable = true;
|
||||
enableNushellIntegration = true;
|
||||
};
|
||||
|
||||
test.stubs.yazi = { };
|
||||
|
||||
nmt.script = let
|
||||
configPath = if pkgs.stdenv.isDarwin then
|
||||
"home-files/Library/Application Support/nushell/config.nu"
|
||||
else
|
||||
"home-files/.config/nushell/config.nu";
|
||||
in ''
|
||||
assertFileContains '${configPath}' '${shellIntegration}'
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue