Skip to content

Commit efa3691

Browse files
committed
fix: don't require a Run() method on dynamic commands
Commands can be dispatched via string, so this is not necessary to constitute a command.
1 parent 385f9b6 commit efa3691

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

options.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,6 @@ type dynamicCommand struct {
9999
// "tags" is a list of extra tag strings to parse, in the form <key>:"<value>".
100100
func DynamicCommand(name, help, group string, cmd any, tags ...string) Option {
101101
return OptionFunc(func(k *Kong) error {
102-
if run := getMethod(reflect.Indirect(reflect.ValueOf(cmd)), "Run"); !run.IsValid() {
103-
return fmt.Errorf("kong: DynamicCommand %q must be a type with a 'Run' method; got %T", name, cmd)
104-
}
105-
106102
k.dynamicCommands = append(k.dynamicCommands, &dynamicCommand{
107103
name: name,
108104
help: help,

0 commit comments

Comments
 (0)