mirror of
https://github.com/stashapp/stash.git
synced 2026-01-01 05:03:53 +01:00
* Upgrade gqlgen to v0.17.2 This enables builds on Go 1.18. github.com/vektah/gqlparser is upgraded to the newest version too. Getting this to work is a bit of a hazzle. I had to first remove vendoring from the repository, perform the upgrade and then re-introduce the vendor directory. I think gqlgens analysis went wrong for some reason on the upgrade. It would seem a clean-room installation fixed it. * Bump project to 1.18 * Update all packages, address gqlgenc breaking changes * Let `go mod tidy` handle the go.mod file * Upgrade linter to 1.45.2 * Introduce v1.45.2 of the linter The linter now correctly warns on `strings.Title` because it isn't unicode-aware. Fix this by using the suggested fix from x/text/cases to produce unicode-aware strings. The mapping isn't entirely 1-1 as this new approach has a larger iface: it spans all of unicode rather than just ASCII. It coincides for ASCII however, so things should be largely the same. * Ready ourselves for errchkjson and contextcheck. * Revert dockerfile golang version changes for now Co-authored-by: Kermie <kermie@isinthe.house> Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
3.6 KiB
3.6 KiB
Generating Zsh Completion For Your cobra.Command
Please refer to Shell Completions for details.
Zsh completions standardization
Cobra 1.1 standardized its zsh completion support to align it with its other shell completions. Although the API was kept backwards-compatible, some small changes in behavior were introduced.
Deprecation summary
See further below for more details on these deprecations.
cmd.MarkZshCompPositionalArgumentFile(pos, []string{})is no longer needed. It is therefore deprecated and silently ignored.cmd.MarkZshCompPositionalArgumentFile(pos, glob[])is deprecated and silently ignored.- Instead use
ValidArgsFunctionwithShellCompDirectiveFilterFileExt.
- Instead use
cmd.MarkZshCompPositionalArgumentWords()is deprecated and silently ignored.- Instead use
ValidArgsFunction.
- Instead use
Behavioral changes
Noun completion
| Old behavior | New behavior |
|---|---|
| No file completion by default (opposite of bash) | File completion by default; use ValidArgsFunction with ShellCompDirectiveNoFileComp to turn off file completion on a per-argument basis |
Completion of flag names without the - prefix having been typed |
Flag names are only completed if the user has typed the first - |
cmd.MarkZshCompPositionalArgumentFile(pos, []string{}) used to turn on file completion on a per-argument position basis |
File completion for all arguments by default; cmd.MarkZshCompPositionalArgumentFile() is deprecated and silently ignored |
cmd.MarkZshCompPositionalArgumentFile(pos, glob[]) used to turn on file completion with glob filtering on a per-argument position basis (zsh-specific) |
cmd.MarkZshCompPositionalArgumentFile() is deprecated and silently ignored; use ValidArgsFunction with ShellCompDirectiveFilterFileExt for file extension filtering (not full glob filtering) |
cmd.MarkZshCompPositionalArgumentWords(pos, words[]) used to provide completion choices on a per-argument position basis (zsh-specific) |
cmd.MarkZshCompPositionalArgumentWords() is deprecated and silently ignored; use ValidArgsFunction to achieve the same behavior |
Flag-value completion
| Old behavior | New behavior |
|---|---|
| No file completion by default (opposite of bash) | File completion by default; use RegisterFlagCompletionFunc() with ShellCompDirectiveNoFileComp to turn off file completion |
cmd.MarkFlagFilename(flag, []string{}) and similar used to turn on file completion |
File completion by default; cmd.MarkFlagFilename(flag, []string{}) no longer needed in this context and silently ignored |
cmd.MarkFlagFilename(flag, glob[]) used to turn on file completion with glob filtering (syntax of []string{"*.yaml", "*.yml"} incompatible with bash) |
Will continue to work, however, support for bash syntax is added and should be used instead so as to work for all shells ([]string{"yaml", "yml"}) |
cmd.MarkFlagDirname(flag) only completes directories (zsh-specific) |
Has been added for all shells |
Completion of a flag name does not repeat, unless flag is of type *Array or *Slice (not supported by bash) |
Retained for zsh and added to fish |
Completion of a flag name does not provide the = form (unlike bash) |
Retained for zsh and added to fish |
Improvements
- Custom completion support (
ValidArgsFunctionandRegisterFlagCompletionFunc()) - File completion by default if no other completions found
- Handling of required flags
- File extension filtering no longer mutually exclusive with bash usage
- Completion of directory names within another directory
- Support for
=form of flags