From f0a3451322f130a516ebe861c45d6955a2a00ab1 Mon Sep 17 00:00:00 2001 From: Daniel Nagy Date: Thu, 10 Aug 2023 14:30:00 +0200 Subject: [PATCH] jc: add shell completions --- pkgs/development/python-modules/jc/default.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/development/python-modules/jc/default.nix b/pkgs/development/python-modules/jc/default.nix index 5fdc44912319..cd6f4060fc96 100644 --- a/pkgs/development/python-modules/jc/default.nix +++ b/pkgs/development/python-modules/jc/default.nix @@ -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" ];