Skip to content

Incorrect behavior of the built-in help message for the help option #234

@vanyauhalin

Description

@vanyauhalin

Setup

$ 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions