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
Currently, suggestions for "unknown command" are not working for subcommands. For example code[1](wants to accept only when
subcommand specified), I expected that cobra give us suggestions like:
Expected
$ go run main.go echo time
Error: unknown command "time" for "echo"
Did you mean this?
times
However, cobra does not suggest anything unfortunately. SuggestFor: attribute also does not work currently.
Workaround
If I use OnlyValidArgs for the subcommands, this could be
solve. However, it does not suit when a command has many subcommands
and makes it makes difficult to maintain.
Motivation
Currently, suggestions for "unknown command" are not working for
subcommands. For example code[1](wants to accept only when
subcommand specified), I expected that cobra give us suggestions like:
Expected
However, cobra does not suggest anything unfortunately.
SuggestFor:
attribute also does not work currently.Workaround
If I use
OnlyValidArgs
for the subcommands, this could besolve. However, it does not suit when a command has many subcommands
and makes it makes difficult to maintain.
Proposal patch
#635
[1] example code
The text was updated successfully, but these errors were encountered: