Merge pull request #248916 from nagy/jc-completion

jc: add shell completions
This commit is contained in:
Atemu 2023-08-13 18:25:52 +02:00 committed by GitHub
commit 0bbfea460a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,9 @@
{ lib
, stdenv
, buildPackages
, buildPythonPackage
, fetchFromGitHub
, installShellFiles
, ruamel-yaml
, xmltodict
, pygments
@ -22,6 +25,14 @@ buildPythonPackage rec {
propagatedBuildInputs = [ ruamel-yaml xmltodict pygments ];
nativeBuildInputs = [ installShellFiles ];
postInstall = let emulator = stdenv.hostPlatform.emulator buildPackages; in ''
installShellCompletion --cmd jc \
--bash <(${emulator} $out/bin/jc --bash-comp) \
--zsh <(${emulator} $out/bin/jc --zsh-comp)
'';
nativeCheckInputs = [ pytestCheckHook ];
pythonImportsCheck = [ "jc" ];