Skip to content

Flag value same as subcommand name result in error #2

@sirmar

Description

@sirmar

Here is another bug I found

Minimal example:

package main

import (
	"log"
	"github.com/devfacet/gocmd"
)

func main() {
	flags := struct {
		Command struct {} `command:"command"`
		Flag string `short:"f" long:"flag" required:"true"`
	}{}

	_, err := gocmd.New(gocmd.Options{
		Flags:       &flags,
		AnyError:    true,
	})

	if err != nil {
		log.Fatal(err)
	}
}

When running:

# bug -f command
argument -f needs a nonempty value

# bug -f "command"
argument -f needs a nonempty value

# bug -f other

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