Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flags not parsed when additional args are provided #11

Open
Wulfheart opened this issue May 17, 2020 · 0 comments
Open

Flags not parsed when additional args are provided #11

Wulfheart opened this issue May 17, 2020 · 0 comments

Comments

@Wulfheart
Copy link

Wulfheart commented May 17, 2020

Example:

package main

import (
	"fmt"
	"github.com/leaanthony/clir"
)

func main() {
	cli := clir.NewCli("test", "Test", "v0.0.0")
	s := cli.NewSubCommand("sub", "Desc")
	var f string
	s.StringFlag("f", "De", &f)
	s.Action(func() error {
		fmt.Println(f)
		return nil
	})
	cli.Run()
}

Command

go run main.go sub file -help

Expected output

test v0.0.0 - Test

test sub - Desc
Flags:

  -f string
        De
  -help
        Get help on the 'test sub' command.

Actual output


Update

It seems that if the additional argument is provided after the flags it just works fine. However I don't consider this a viable solution. Now I can see some parallels to #9.


I am going to address this in a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant