Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commands/run.go: hide descriptions in completions
In commit 1572300 of PR git-lfs#5311 the "git lfs completion" command was introduced, utilizing the support provided by the spf13/cobra package to generate tab-completion scripts for a number of shells, including the Bash, fish, and Zsh shells. These scripts make use of "hidden" __complete and __completeNoDesc commands, also implemented by the spf13/cobra package, which the shell completion functions may query to retrieve dynamic lists of command names and flags from the Git LFS client. At present, the __complete command is used, which also returns any short help text defined each command. This additional descriptive text is then presented to the user if they are running a shell like Zsh whose completion system supports the display of such hints. However, as we only define short help text for a single Git LFS command, namely the "git lfs help" command, the display of this one text string causes the columnar display of available command names to be prefaced with a single "help" line when the user types "git lfs [Tab]": help -- Help about any command checkout fsck post-checkout status clean install post-commit track ... ... ... ... This irregularity makes the display output less helpful and more difficult to parse than if we simply suppress the inclusion of the per-command descriptions entirely, so we do so by setting the appropriate flags or using a different script generation method of the spf13/cobra package. Note that we then also need to update the name of the __complete command to __completeNoDesc in the search-and-replace operation we perform on the script generated for the Zsh shell. We can always revisit this choice in the future should we choose to add short help text to all our command definitions. This would require refactoring our NewCommand() and RegisterCommand() functions to accept the per-command text strings as extra parameters.
- Loading branch information