1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-15 07:39:46 +01:00
home-manager/tests/modules/programs/thefuck/integration-enabled.nix
Sebastian Zivota b9b9b5aab0
thefuck: add fish integration (#4535)
Co-authored-by: Sumner Evans <me@sumnerevans.com>
2024-04-10 21:26:33 +02:00

37 lines
1.1 KiB
Nix

{ ... }:
{
programs = {
thefuck.enable = true;
bash.enable = true;
fish.enable = true;
zsh.enable = true;
};
test.stubs.thefuck = { };
nmt.script = ''
assertFileExists home-files/.bashrc
assertFileContains \
home-files/.bashrc \
'eval "$(@thefuck@/bin/thefuck '"'"'--alias'"'"')"'
assertFileExists home-files/.config/fish/functions/fuck.fish
assertFileContains \
home-files/.config/fish/functions/fuck.fish \
'function fuck --description="Correct your previous console command"
set -l fucked_up_command $history[1]
env TF_SHELL=fish TF_ALIAS=fuck PYTHONIOENCODING=utf-8 @thefuck@/bin/thefuck $fucked_up_command THEFUCK_ARGUMENT_PLACEHOLDER $argv | read -l unfucked_command
if [ "$unfucked_command" != "" ]
eval $unfucked_command
builtin history delete --exact --case-sensitive -- $fucked_up_command
builtin history merge
end
end'
assertFileExists home-files/.zshrc
assertFileContains \
home-files/.zshrc \
'eval "$(@thefuck@/bin/thefuck '"'"'--alias'"'"')"'
'';
}