From 02573873ec68b7b93f93b9a7f5e8132195ae43c6 Mon Sep 17 00:00:00 2001 From: Diego Pontoriero <74719+diegs@users.noreply.github.com> Date: Wed, 22 Feb 2023 02:21:34 -0800 Subject: [PATCH] nodePackages.graphite-cli: fix zsh completion The yargs library auto-detects the shell from the environment to emit the appropriate completion script. Currently the override is emitting the bash completion script twice. Setting ZSH_NAME=zsh is a simple way to emit the zshell completion script. --- pkgs/development/node-packages/overrides.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/development/node-packages/overrides.nix b/pkgs/development/node-packages/overrides.nix index f3a450d28840..3c22331fe5a2 100644 --- a/pkgs/development/node-packages/overrides.nix +++ b/pkgs/development/node-packages/overrides.nix @@ -188,10 +188,12 @@ final: prev: { graphite-cli = prev."@withgraphite/graphite-cli".override { name = "graphite-cli"; nativeBuildInputs = [ pkgs.installShellFiles ]; + # 'gt completion' auto-detects zshell from environment variables: + # https://github.com/yargs/yargs/blob/2b6ba3139396b2e623aed404293f467f16590039/lib/completion.ts#L45 postInstall = '' installShellCompletion --cmd gt \ --bash <($out/bin/gt completion) \ - --zsh <($out/bin/gt completion) + --zsh <(ZSH_NAME=zsh $out/bin/gt completion) ''; };