fish: query pname and version for completions
Query the `pname` and `version` attributes for completion generation, if the `name` attribute is not available. Fixes #2813
This commit is contained in:
parent
ed0770e962
commit
31a27e4806
|
@ -320,24 +320,29 @@ in {
|
|||
${postBuild}
|
||||
'';
|
||||
|
||||
generateCompletions = package:
|
||||
pkgs.runCommand "${package.name}-fish-completions" {
|
||||
srcs = [ package ] ++ filter (p: p != null)
|
||||
(builtins.map (outName: package.${outName} or null)
|
||||
config.home.extraOutputsToInstall);
|
||||
nativeBuildInputs = [ pkgs.python3 ];
|
||||
buildInputs = [ cfg.package ];
|
||||
preferLocalBuild = true;
|
||||
} ''
|
||||
mkdir -p $out
|
||||
for src in $srcs; do
|
||||
if [ -d $src/share/man ]; then
|
||||
find -L $src/share/man -type f \
|
||||
| xargs python ${cfg.package}/share/fish/tools/create_manpage_completions.py --directory $out \
|
||||
> /dev/null
|
||||
fi
|
||||
done
|
||||
'';
|
||||
generateCompletions = let
|
||||
getName = attrs:
|
||||
attrs.name or "${attrs.pname or "«pname-missing»"}-${
|
||||
attrs.version or "«version-missing»"
|
||||
}";
|
||||
in package:
|
||||
pkgs.runCommand "${getName package}-fish-completions" {
|
||||
srcs = [ package ] ++ filter (p: p != null)
|
||||
(builtins.map (outName: package.${outName} or null)
|
||||
config.home.extraOutputsToInstall);
|
||||
nativeBuildInputs = [ pkgs.python3 ];
|
||||
buildInputs = [ cfg.package ];
|
||||
preferLocalBuild = true;
|
||||
} ''
|
||||
mkdir -p $out
|
||||
for src in $srcs; do
|
||||
if [ -d $src/share/man ]; then
|
||||
find -L $src/share/man -type f \
|
||||
| xargs python ${cfg.package}/share/fish/tools/create_manpage_completions.py --directory $out \
|
||||
> /dev/null
|
||||
fi
|
||||
done
|
||||
'';
|
||||
in destructiveSymlinkJoin {
|
||||
name = "${config.home.username}-fish-completions";
|
||||
paths =
|
||||
|
|
Loading…
Reference in a new issue