You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i used RegisterFlagCompletionFunc to build dynamic completion.
_=cmd.RegisterFlagCompletionFunc("license", func(cmd*cobra.Command, args []string, toCompletestring) ([]string, cobra.ShellCompDirective) {
data, err:=httpRequest()
iferr!=nil {
// this is not workfmt.Println("completion error:",err.Error())
returnnil, cobra.ShellCompDirectiveNoFileComp
}
}
and want to print error info. but it does not work.
when i use
mycmd --myflag [tab][tab]
# the error info has splited
2h35m54.224688284s [completion error] is to Unauthorized
by due expired reason token
i can‘t get origin error print. only with __complete can got it.
mycmd __complete --myflag ""[enter]
[completion error] Unauthorized due to reason token is expired by 2h38m9.850332898s
:4
Completion ended with directive: ShellCompDirectiveNoFileComp
The text was updated successfully, but these errors were encountered:
Hi @lixd. You cannot currently print error messages for the users to see when doing shell completion. When there is an error usually people return no completions.
If you are interested in printing a message to the actual user when they perform completion, the new ActiveHelp feature of #1482 will allow to do that (for bash and zsh only).
The Cobra project currently lacks enough contributors to adequately respond to all issues. This bot triages issues and PRs according to the following rules:
After 60d of inactivity, lifecycle/stale is applied. - After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied and the issue is closed.
You can:
Make a comment to remove the stale label and show your support. The 60 days reset. - If an issue has lifecycle/rotten and is closed, comment and ask maintainers if they'd be interseted in reopening
i used RegisterFlagCompletionFunc to build dynamic completion.
and want to print error info. but it does not work.
when i use
mycmd --myflag [tab][tab] # the error info has splited 2h35m54.224688284s [completion error] is to Unauthorized by due expired reason token
i can‘t get origin error print. only with __complete can got it.
mycmd __complete --myflag ""[enter] [completion error] Unauthorized due to reason token is expired by 2h38m9.850332898s :4 Completion ended with directive: ShellCompDirectiveNoFileComp
The text was updated successfully, but these errors were encountered: