integrii / flaggy

Idiomatic Go input parsing with subcommands, positional values, and flags at any position. No required project or package layout and no external dependencies.
The Unlicense
856 stars 30 forks source link

Process multiple short options with single dash #49

Open kost opened 4 years ago

kost commented 4 years ago

If following option is enabled: flaggy.DefaultParser.ProcessMultipleShorts = true

following multiple options : -e -x -a -m -p -l can be written as: -exampl

Since, it breaks previous behaviour, it is added as an option to the parser.

integrii commented 4 years ago

Thanks Kost. I am going to review this tonight - sorry for the delay!

I really appreciate the contribution.

integrii commented 4 years ago

We definitely want to get a test or two in here to validate the functionality. I would also like to see more functions and flatter code in this - that's a lot of indents to the right to consider.

I wonder if there is a way to add this functionality by default. I believe POSIX specifies that double dashes -- denotes an upcoming long flag while a single dash - denotes a short flag (or multiple short flags). We could potentially enable this and call it flaggy version 2.0.0.

How would you feel about that?

kost commented 4 years ago

I'm completely fine whatever you decide. Feel free to make it default or not. Also, feel free to flatter the code or test functionality.