1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-23 11:39:46 +01:00

fish: make generation of completions optional

Add a config option to optionally disable the generation of command
completions based upon man pages.
This commit is contained in:
Jeffrey C. Ollie 2024-02-05 19:34:52 -06:00 committed by Robert Helgesson
parent 5bb057a7b5
commit 1d9b4a3e60
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED

View file

@ -253,6 +253,12 @@ in {
''; '';
}; };
generateCompletions = mkEnableOption
"the automatic generation of completions based upon installed man pages"
// {
default = true;
};
shellAliases = mkOption { shellAliases = mkOption {
type = with types; attrsOf str; type = with types; attrsOf str;
default = { }; default = { };
@ -390,9 +396,9 @@ in {
}; };
config = mkIf cfg.enable (mkMerge [ config = mkIf cfg.enable (mkMerge [
{ { home.packages = [ cfg.package ]; }
home.packages = [ cfg.package ];
(mkIf cfg.generateCompletions {
# Support completion for `man` by building a cache for `apropos`. # Support completion for `man` by building a cache for `apropos`.
programs.man.generateCaches = mkDefault true; programs.man.generateCaches = mkDefault true;
@ -456,7 +462,9 @@ in {
set fish_complete_path $prev "${config.xdg.dataHome}/fish/home-manager_generated_completions" $post set fish_complete_path $prev "${config.xdg.dataHome}/fish/home-manager_generated_completions" $post
end end
''; '';
})
{
xdg.configFile."fish/config.fish".source = fishIndent "config.fish" '' xdg.configFile."fish/config.fish".source = fishIndent "config.fish" ''
# ~/.config/fish/config.fish: DO NOT EDIT -- this file has been generated # ~/.config/fish/config.fish: DO NOT EDIT -- this file has been generated
# automatically by home-manager. # automatically by home-manager.