You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many thanks for this library - saved a lot of time!
One feature which I think might be useful is a way to find unused parameters or flags.
As the library returns argument details, that part of the arg string could be marked as used, and then the set of unused things would be available to query.
The utility of this would be in commandline error handling - if at the end of processing you can see unused parameters/flags, that might be evidence of spelling mistakes etc, which can be reported to potentially puzzled users.
The text was updated successfully, but these errors were encountered:
The thing is, that argh does not presume or try to know what args are actually expected, mandatory and/or valid. (Predefined params are mostly meant to automatically distinguish between params (with values) and flags).
It is only interested in parsing the args provided per-run.
It is the user's responsibility to enforce any semantics on the provided args.
mcginnie
changed the title
Add Functionality To Find Unused Commanline Options
Add Functionality To Find Unused Commandline Options
Mar 2, 2024
Thank you for such a quick response. I understand the agnostic approach - and sympathise.
My thinking is that each datum (flag, parameter name) could be represented by a std::pair<std::string, bool{false}> (rather than just a std::string as now) where the bool is set true on any output access using () or []. It would then be possible to iterate over utilise or unutilised commandline arguments.
This does not impose any interpretation nor semantic rules on the library, but does record what has been used and what not. Since many commandline errors will come from mis-spellings rather than complete novelty, displaying any unused commandline parts will prompt the user in an easily interpreted way (e.g. why is my -file option not used - because it should be -filename).
Doing something similar from outside the library strikes me as considerably more work.
Many thanks for this library - saved a lot of time!
One feature which I think might be useful is a way to find unused parameters or flags.
As the library returns argument details, that part of the arg string could be marked as used, and then the set of unused things would be available to query.
The utility of this would be in commandline error handling - if at the end of processing you can see unused parameters/flags, that might be evidence of spelling mistakes etc, which can be reported to potentially puzzled users.
The text was updated successfully, but these errors were encountered: