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
@@ -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" ];