integrii/flaggy

Refactor how - and -- are handled

integrii opened this issue · 1 comments

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:

  • If a single dash (-) is used, then we treat every following character as its own flag
  • if a double dash (--) is used, then we treat the following as one long flag name

Relevant to #49