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

Positional arguments with dashes #55

Closed
cirocosta opened this issue Aug 22, 2017 · 2 comments
Closed

Positional arguments with dashes #55

cirocosta opened this issue Aug 22, 2017 · 2 comments

Comments

@cirocosta
Copy link

cirocosta commented Aug 22, 2017

Hey,

I was wondering wether it's possible to a []string as the destination of positional arguments that may container -prefixed strings. My use case is ./my-bin --debug my_first_pos_arg -something where I expect the []string{"my_first_pos_arg", "-something"} to be retrieved as the positional arguments given that I have something like

type Something struct {
    Debug      bool     `arg:"-d"`
    Positional []string `arg:"positional"`
}

Is this possible to be consumed by go-arg?

Also, thanks a lot for go-arg! It's my go-to every time I need something quick and simple 👍

Thx!

@cirocosta cirocosta changed the title Positional Arguments with dashes Positional arguments with dashes Aug 22, 2017
@alexflint
Copy link
Owner

The only way to do this is by writing

./my-bin --debug -- my_first_pos_arg -something

Everything after -- is treated as a positional argument.

@cirocosta
Copy link
Author

Oh, it works like a charm! Thanks a bunch @alexflint !

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

2 participants