allow explicit help-only
This commit is contained in:
parent
a2f207272a
commit
4e41fcda6d
2 changed files with 32 additions and 13 deletions
|
|
@ -51,6 +51,16 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
helpOnlyCommands = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ ];
|
||||
example = [ "nix" ];
|
||||
description = ''
|
||||
list of command names to skip manpage parsing for,
|
||||
using --help scraping instead
|
||||
'';
|
||||
};
|
||||
|
||||
snippet = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
readOnly = true;
|
||||
|
|
@ -65,12 +75,14 @@ in
|
|||
destDir = "$out${cfg.completionsPath}";
|
||||
ignoreFile = pkgs.writeText "inshellah-ignore" (lib.concatStringsSep "\n" cfg.ignoreCommands);
|
||||
ignoreFlag = lib.optionalString (cfg.ignoreCommands != [ ]) " --ignore ${ignoreFile}";
|
||||
helpOnlyFile = pkgs.writeText "inshellah-help-only" (lib.concatStringsSep "\n" cfg.helpOnlyCommands);
|
||||
helpOnlyFlag = lib.optionalString (cfg.helpOnlyCommands != [ ]) " --help-only ${helpOnlyFile}";
|
||||
in
|
||||
''
|
||||
mkdir -p ${destDir}
|
||||
|
||||
if [ -d "$out/bin" ] && [ -d "$out/share/man" ]; then
|
||||
${inshellah} index "$out" --dir ${destDir}${ignoreFlag} \
|
||||
${inshellah} index "$out" --dir ${destDir}${ignoreFlag}${helpOnlyFlag} \
|
||||
2>/dev/null || true
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue