-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hiding options #127
Comments
I just added a way to make them not make it to the help table..Make help[param] == "SUPRESS" - see release notes. Also, the use case of regular suppress is to allow Nim API calls to have parameters not exported to the CLI. While I realize that most people just ignore my advice to keep important functionality Nim importable/callable, I do try to make it easier when it is not hard for me to do. |
I realize the semantics aka "level of hiding" in this new feature may not be quite what everyone might want. It will still need a param, for example. It sounds like you may want something like a new |
Oh, and to expand on the "level of hiding" and workarounds/shenanigans, one wrinkle is the "type" and parsability of arguments. To match syntax, vestigial To both preserve the syntax including bool/noarg or not, still allow use by a CL user but have that be a true no-op, and disallow help table presentation would probably require a new |
I'll try this pretty soon. Thanks. I think it should be "HIDE" instead of "SUPPRESS", so we don't overload the word "suppress". |
Hmm. I had been thinking I was economizing on pseudo-keyword-type entities, but you may be right. What was going through my head is help["param"]=="SUPPRESS" just "suppresses the help part", but nothing else. It's not really "hidden" from the parser. "NOHELP" might be better as being most explicit about what is going on. Of course, the CL author can change the string by setting |
Oh, and I should say that if we are going to change it, it would be best to do so before I stamp the 0.9.41 release whenever that is. I don't know if @luav (or anyone) has even started using it yet. |
Either "HIDE" or "NOHELP" would be fine. Could you show a small example? I don't understand what "param" should be. (Note that I use multi-dispatch.) |
|
(I often say "param" to refer to the parameter of the API call being wrapped by |
@c-blake The example is pretty helpful but I would unlikely be able to find it without reading this conversation. It would be convenient to name the examples by their features, e.g. And one more thing concerning the parameter hiding implementation: it might be more safe to use string references allowing |
I agree there are many features. If you want to write a "locator table" then I would include it. To me the biggest obstacle (to any approach) is that there are a great many "synonyms" by which various people might look for some feature. Nim used to have |
(Oh, and if you didn't notice from the git commit, I made a new |
I even show how to change the string if you want in that test/demo program now. |
It works for me, but |
|
|
Cool. As mentioned above, if you keep the Nim types of your no-longer-used parameters the same then they will still have "the old errors" if some CL user gives them a bad value. That could be cast as either a bug or as a feature, but it's definitely the easier of the two implementation strategies. |
I'd like to be able to hide options from the user.
(The use-case is to maintain backwards-compatibility with another tool. I want to parse and ignore a large number of options that I do not need anymore.)
I see a field called
suppress
, but that removes the option completely. (And honestly, I don't see a use-case for that. If you don't want an option at all, you should remove it from your function signature. If that is impossible, then wrap your function.)For now, I will have to keep the old options and just mark them as IGNORED.
The text was updated successfully, but these errors were encountered: