croc icon indicating copy to clipboard operation
croc copied to clipboard

[Shell Completion] Avoid setting ${PROG} by replacing "$PROG" with "croc"

Open ghost opened this issue 3 years ago • 1 comments

What and How

From #253, #282 and croc Installer Script, it seems that to have zsh completion, the user needs to add these to their .zshrc.

  • PROG=croc
  • CLI_ZSH_AUTOCOMPLETE_HACK=1
  • source /whatever/path/to/zsh/zsh_autocomplete_croc

However, the first can be avoided by replacing $PROG with croc in zsh_autocomplete.

Why

  • One less shell variable in the environment
  • Avoid conflicts when multiple programs use the autocomplete from urfave/cli (read: croc and let's say, brob both wish to set $PROG, so one loses its shell completion)
  • Why not? Is there any particular reason not to do that 😃?

Additional context

By the way, would you mind adding documentation about shell completion? Neither README.md nor your blog ever mention it at all. I came to know that only by checking installer script (and later, archived binary in release page) 😦.

ghost avatar Apr 06 '21 05:04 ghost

Happy to accept PRs for any of these things (updating documentation, or changing the zsh_autocomplete_croc file to avoid PROG).

schollz avatar Apr 13 '21 22:04 schollz

Stale issue message

github-actions[bot] avatar Mar 17 '24 12:03 github-actions[bot]