jc: add shell completions

This commit is contained in:
Daniel Nagy 2023-08-10 14:30:00 +02:00
parent 44966546d6
commit f0a3451322
No known key found for this signature in database
GPG key ID: 1B8E8DCB576FB671

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