chore: optionally allow parsing of hyphen-prefixied flag parameters

This allows for eg. `foo --number -10`, `foo --flag -bar`.

Fixes #478, #315.
This commit is contained in:
Alec Thomas
2025-05-15 19:31:29 +10:00
parent 8e03dbeaf6
commit 9bc3bf9925
5 changed files with 69 additions and 22 deletions
+1 -1
View File
@@ -99,7 +99,7 @@ type Context struct {
// This just constructs a new trace. To fully apply the trace you must call Reset(), Resolve(),
// Validate() and Apply().
func Trace(k *Kong, args []string) (*Context, error) {
s := Scan(args...)
s := Scan(args...).AllowHyphenPrefixedParameters(k.allowHyphenated)
c := &Context{
Kong: k,
Args: args,