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

Refactor how - and -- are handled #51

Open integrii opened 4 years ago

integrii commented 4 years ago

In some circles, using a single - means that the next character will be a single-character flag and if there are multiple letters, they should be treated like a list of single-character flags. If a double dash is used (--) then we should consider the following characters all part of a single flag until a space or = is seen.

Right now, flaggy does not parse differently when it sees a - or --. This means that single letter flags can not be grouped up.

For example, this command would be parsed with two flags by some parsers:

docker exec -it

However in flaggy, this would be treated as one long flag named it.

I propose that we refactor flaggy with the following logic:

integrii commented 4 years ago

Relevant to #49