SIGN IN SIGN UP
spf13 / cobra UNCLAIMED

A Commander for modern Go CLI interactions

0 0 138 Go

Remove the default "completion" cmd if it is alone (#1559)

When a program has no sub-commands, its root command can accept
arguments.  If we add the default "completion" command to such programs
they will now have a sub-command and will no longer accept arguments.

What we do instead for this special case, is only add the "completion"
command if it is being called, or if it is being completed itself.

We want to have the "completion" command for such programs because it
will allow the completion of flags and of arguments (if provided
by the program).

Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
M
Marc Khouzam committed
24ada7fe71e3a3a8741dd52e0a7fc3b97450535a
Parent: 680936a
Committed by GitHub <noreply@github.com> on 2/15/2025, 6:07:02 PM