catchorg / Clara

A simple to use, composable, command line parser for C++ 11 and beyond
Boost Software License 1.0
648 stars 67 forks source link

"Short" args must be single letter to work, but not checked #91

Open rpavlik opened 5 years ago

rpavlik commented 5 years ago

Discovered "the hard way" in a Catch2-using project that while you are allowed to add flags like ["-abc"] for an Opt, trying to actually specify it will never work - you'll just get:

Error(s) in input:
  Unrecognised token: -a

I imagine it's doing this because it wants to support combining short options. However, in that case, there should probably be a check at parser-creation time for single-letter usage with short option symbol.

grafikrobot commented 4 years ago

I addressed this in the Lyra lib by making ["-abc"] equate to ["-a"]["-b"]["-c"]. As it mirrors the usage and avoid exceptions. Change is available from this version https://github.com/bfgroup/Lyra/commit/d4db7b89263f4331b9e819ed6c4aeb6f128ad327