thefuck: add nushell integration

This commit is contained in:
Alvaro Fresquet 2024-04-29 09:53:42 +02:00 committed by GitHub
parent 9fe79591c1
commit 2af7c78b7b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 0 deletions

View file

@ -32,6 +32,14 @@ with lib;
Whether to enable Zsh integration. Whether to enable Zsh integration.
''; '';
}; };
enableNushellIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Nushell integration.
'';
};
}; };
config = let config = let
@ -66,5 +74,11 @@ with lib;
}; };
programs.zsh.initExtra = mkIf cfg.enableZshIntegration shEvalCmd; programs.zsh.initExtra = mkIf cfg.enableZshIntegration shEvalCmd;
programs.nushell = mkIf cfg.enableNushellIntegration {
extraConfig = ''
alias fuck = ${cfg.package}/bin/thefuck $"(history | last 1 | get command | get 0)"
'';
};
}; };
} }

View file

@ -6,8 +6,10 @@
thefuck.enableBashIntegration = false; thefuck.enableBashIntegration = false;
thefuck.enableFishIntegration = false; thefuck.enableFishIntegration = false;
thefuck.enableZshIntegration = false; thefuck.enableZshIntegration = false;
thefuck.enableNushellIntegration = false;
bash.enable = true; bash.enable = true;
zsh.enable = true; zsh.enable = true;
nushell.enable = true;
}; };
test.stubs.thefuck = { }; test.stubs.thefuck = { };
@ -16,5 +18,6 @@
assertFileNotRegex home-files/.bashrc '@thefuck@/bin/thefuck' assertFileNotRegex home-files/.bashrc '@thefuck@/bin/thefuck'
assertPathNotExists home-files/.config/fish/functions/fuck.fish assertPathNotExists home-files/.config/fish/functions/fuck.fish
assertFileNotRegex home-files/.zshrc '@thefuck@/bin/thefuck' assertFileNotRegex home-files/.zshrc '@thefuck@/bin/thefuck'
assertFileNotRegex home-files/.config/nushell/config.nu '@thefuck@/bin/thefuck'
''; '';
} }

View file

@ -6,6 +6,7 @@
bash.enable = true; bash.enable = true;
fish.enable = true; fish.enable = true;
zsh.enable = true; zsh.enable = true;
nushell.enable = true;
}; };
test.stubs.thefuck = { }; test.stubs.thefuck = { };
@ -33,5 +34,10 @@
assertFileContains \ assertFileContains \
home-files/.zshrc \ home-files/.zshrc \
'eval "$(@thefuck@/bin/thefuck '"'"'--alias'"'"')"' 'eval "$(@thefuck@/bin/thefuck '"'"'--alias'"'"')"'
assertFileExists home-files/.config/nushell/config.nu
assertFileContains \
home-files/.config/nushell/config.nu \
'alias fuck = @thefuck@/bin/thefuck $"(history | last 1 | get command | get 0)"'
''; '';
} }