Open LeventErkok opened 4 years ago
Thanks Neil!
Unfortunately that's not quite what I want. I still want this to be a valid parameter to the program, just not displayed in the "help" output.
I've found this stack-overflow question that describes the issue https://stackoverflow.com/questions/33199324/hidden-arguments-with-cmdargs
But the accepted solution seems quite hackish and it dates back to 2015. So, I'm wondering if there's a better way to do the same.
Unfortunately nothing better available I'm afraid. I can't think of a better way than that.
Thanks! I'll close this ticket; but feel free to re-open it if you want to implement something! It's definitely a nice-to-have. Much appreciated.
Let's leave open to add - it's pretty hacky as it stands now...
In case this helps anyone else, I found a workaround that sort of works. You first do:
allNames :: [String]
allNames = concatMap flagNames $ modeFlags defaultOptions
where defaultOptions
is the record you construct for arguments. This grabs all the flag names. Then, do a preprocessing step and check all "flag-like" arguments to be in this list before calling cmdArgs
itself. If you find anything outside, you can do a more detailed analysis as needed.
Rather hackish, but it does do the trick for my use case. I'd like to hear if anyone has a better idea that doesn't require mocking with cmdArgs
itself.
Is there a way to add an argument, but not make it show up in the help message? (Useful in implementing backdoor developer-only testing features.)