mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-21 21:09:00 +02:00
commitizen: add shell completions
Co-authored-by: Artturi <Artturin@artturin.com>
This commit is contained in:
parent
dcf4a134a6
commit
2a780f5572
|
@ -3,6 +3,8 @@
|
|||
, fetchFromGitHub
|
||||
, git
|
||||
, python3
|
||||
, stdenv
|
||||
, installShellFiles
|
||||
, testers
|
||||
}:
|
||||
|
||||
|
@ -25,6 +27,7 @@ python3.pkgs.buildPythonApplication rec {
|
|||
nativeBuildInputs = with python3.pkgs; [
|
||||
poetry-core
|
||||
pythonRelaxDepsHook
|
||||
installShellFiles
|
||||
];
|
||||
|
||||
propagatedBuildInputs = with python3.pkgs; [
|
||||
|
@ -77,6 +80,18 @@ python3.pkgs.buildPythonApplication rec {
|
|||
"test_commitizen_debug_excepthook"
|
||||
];
|
||||
|
||||
postInstall =
|
||||
let
|
||||
argcomplete = lib.getExe' python3.pkgs.argcomplete "register-python-argcomplete";
|
||||
in
|
||||
lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform)
|
||||
''
|
||||
installShellCompletion --cmd cz \
|
||||
--bash <(${argcomplete} --shell bash $out/bin/cz) \
|
||||
--zsh <(${argcomplete} --shell zsh $out/bin/cz) \
|
||||
--fish <(${argcomplete} --shell fish $out/bin/cz)
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
tests.version = testers.testVersion {
|
||||
package = commitizen;
|
||||
|
|
Loading…
Reference in a new issue