sheldon: fix how commands are combined

This commit is contained in:
Kyure_A 2024-07-30 21:29:22 +09:00
parent 6c65ca95fc
commit abfc68ac8f

View file

@ -46,28 +46,49 @@ in {
source = tomlFormat.generate "sheldon-config" cfg.settings; source = tomlFormat.generate "sheldon-config" cfg.settings;
}; };
programs.bash.initExtra = mkIf (cfg.settings != { }) '' programs.bash.initExtra = concatStringsSep "\n" [
eval "$(sheldon source)" mkIf
'' + mkIf cfg.enableBashCompletions '' (cfg.settings != { })
if [[ $TERM != "dumb" ]]; then ''
eval "$(${cmd} completions --shell=bash)" eval "$(sheldon source)"
fi ''
''; mkIf
cfg.enableBashCompletions
''
if [[ $TERM != "dumb" ]]; then
eval "$(${cmd} completions --shell=bash)"
fi
''
];
programs.zsh.initExtra = mkIf (cfg.settings != { }) '' programs.zsh.initExtra = concatStringsSep "\n" [
eval "$(sheldon source)" mkIf
'' + mkIf cfg.enableZshCompletions '' (cfg.settings != { })
if [[ $TERM != "dumb" ]]; then ''
eval "$(${cmd} completions --shell=zsh)" eval "$(sheldon source)"
fi ''
''; mkIf
cfg.enableZshCompletions
''
if [[ $TERM != "dumb" ]]; then
eval "$(${cmd} completions --shell=zsh)"
fi
''
];
programs.fish.interactiveShellInit = mkIf (cfg.settings != { }) '' programs.fish.interactiveShellInit = concatStringsSep "\n" [
eval "$(sheldon source)" mkIf
'' + mkIf cfg.enableFishCompletions '' (cfg.settings != { })
if test "$TERM" != "dumb" ''
eval "$(${cmd} completions --shell=fish)" eval "$(sheldon source)"
end ''
''; mkIf
cfg.enableFishCompletions
''
if test "$TERM" != "dumb"
eval "$(${cmd} completions --shell=fish)"
end
''
];
}; };
} }