$ cat go.mod
module main
go 1.21.4
require github.com/alexflint/go-arg v1.4.3
require github.com/alexflint/go-scalar v1.1.0 // indirect
$ cat main.go
package main
import (
arg "github.com/alexflint/go-arg"
)
type options struct {
Sub *Sub `arg:"subcommand"`
}
type Sub struct {
A string `arg:"positional"`
}
func main() {
var opts options
arg.MustParse(&opts)
}
Actual
$ go run . sub --help
Usage: main sub [A]
Positional arguments:
A
--help, -h display this help and exit
Expected
$ go run . sub --help
Usage: main sub [A]
Positional arguments:
A
Global options:
--help, -h display this help and exit
Setup
Actual
Expected