From efa36914bb4edb92533ff436d8d934ba32d08395 Mon Sep 17 00:00:00 2001 From: Alec Thomas Date: Mon, 21 Jul 2025 13:22:05 +1000 Subject: [PATCH] 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. --- options.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/options.go b/options.go index a1fa242..5792c12 100644 --- a/options.go +++ b/options.go @@ -99,10 +99,6 @@ type dynamicCommand struct { // "tags" is a list of extra tag strings to parse, in the form :"". func DynamicCommand(name, help, group string, cmd any, tags ...string) Option { return OptionFunc(func(k *Kong) error { - if run := getMethod(reflect.Indirect(reflect.ValueOf(cmd)), "Run"); !run.IsValid() { - return fmt.Errorf("kong: DynamicCommand %q must be a type with a 'Run' method; got %T", name, cmd) - } - k.dynamicCommands = append(k.dynamicCommands, &dynamicCommand{ name: name, help: help,