mirror of
https://github.com/nix-community/home-manager
synced 2024-12-26 03:39:47 +01:00
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
5ca19629fd
commit
5f34ca8c64
1 changed files with 23 additions and 18 deletions
|
@ -320,24 +320,29 @@ in {
|
||||||
${postBuild}
|
${postBuild}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
generateCompletions = package:
|
generateCompletions = let
|
||||||
pkgs.runCommand "${package.name}-fish-completions" {
|
getName = attrs:
|
||||||
srcs = [ package ] ++ filter (p: p != null)
|
attrs.name or "${attrs.pname or "«pname-missing»"}-${
|
||||||
(builtins.map (outName: package.${outName} or null)
|
attrs.version or "«version-missing»"
|
||||||
config.home.extraOutputsToInstall);
|
}";
|
||||||
nativeBuildInputs = [ pkgs.python3 ];
|
in package:
|
||||||
buildInputs = [ cfg.package ];
|
pkgs.runCommand "${getName package}-fish-completions" {
|
||||||
preferLocalBuild = true;
|
srcs = [ package ] ++ filter (p: p != null)
|
||||||
} ''
|
(builtins.map (outName: package.${outName} or null)
|
||||||
mkdir -p $out
|
config.home.extraOutputsToInstall);
|
||||||
for src in $srcs; do
|
nativeBuildInputs = [ pkgs.python3 ];
|
||||||
if [ -d $src/share/man ]; then
|
buildInputs = [ cfg.package ];
|
||||||
find -L $src/share/man -type f \
|
preferLocalBuild = true;
|
||||||
| xargs python ${cfg.package}/share/fish/tools/create_manpage_completions.py --directory $out \
|
} ''
|
||||||
> /dev/null
|
mkdir -p $out
|
||||||
fi
|
for src in $srcs; do
|
||||||
done
|
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 {
|
in destructiveSymlinkJoin {
|
||||||
name = "${config.home.username}-fish-completions";
|
name = "${config.home.username}-fish-completions";
|
||||||
paths =
|
paths =
|
||||||
|
|
Loading…
Reference in a new issue