Commit 5e23831d authored by Joel Pepper's avatar Joel Pepper
Browse files

cobra-cli: fix generated zsh completion function

Ironically, cobra-cli uses an old version of cobra, which generates
slightly incorrect zsh completion files. This commit adds a simple
substitute in place to bring the zsh completion file in line with
current cobra files, without needing to upgrade the cobra dependency
which might become a bigger refactor
parent 1bc4de07
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -44,6 +44,12 @@ buildGoModule rec {
      --bash <($out/bin/cobra-cli completion bash) \
      --fish <($out/bin/cobra-cli completion fish) \
      --zsh <($out/bin/cobra-cli completion zsh) \

    # Ironically, cobra-cli still uses old, slightly buggy completion code
    # This will correct the #compdef tag and add separate compdef line
    # allowing direct sourcing to also activate the completion
    substituteInPlace "$out/share/zsh/site-functions/_cobra-cli" \
      --replace-fail '#compdef _cobra-cli cobra-cli' "#compdef cobra-cli''\ncompdef _cobra-cli cobra-cli"
  '';

  meta = {