-
Notifications
You must be signed in to change notification settings - Fork 290
[Question] How to have global parameters #257
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
Comments
I have just looked at the pre-release version of this project, and it looks like it included a default |
#250 explains why I'm replying late... @gep13, for the moment 2.0.*-beta (very close to be promoted RC and than STABLE), doesn't support short options name for built-in This choice is conventional and based on standard *nix utility based that implements I don't think this will be changed, but you can do this in a custom fork with easy. In Let's take MakeVersionEntry: just replace I hope this helped. :) |
@gsscoder yip, I had already read that issue, so I appreciate you taking the time to get back to me! I guess the reason that I was asking was that with some other tools, like node, npm, gulp, bower, etc, I can run the So, for the sake of consistency, I wanted to add the same to my console applications. I am a Windows guy, so I am not clear on what you are referring to when you say:
But I will take your word for it 😄 I will have a think about whether I want to take a fork for commandline to get what I want. Thanks again. |
@gep13, consistency is always a good thing, nowadays a lot of terminal commands mix a lot of styles allowing long options with a single dash and other things. Requesting version with a short option is not really so out-of-standard and after 2.0 reaches STABLE status this choice can be re-evaluated. There's another "philosophical" choice in implementing built-in Now we can open a discussion about if this makes sense or not... For what I can observe, more a terminal command stick to "common standard" and more exposes these two commands only as long options. Thanks for starting an interesting discussion, not only code submission allow a project to grow... :) So we can rethink this after 2.0 reaches STABLE status, as said. Thank you again. |
Sounds like a plan to me :-) As a side note, if I wanted to add some additional top level arguments, similar to Thanks again! |
You could add a new verb for each. |
Ah, of course, thank you! I think I was overthinking the problem 😄 |
Problem solved, closing this. :) |
I was hoping that someone will be able to help me, with what I am referring to as global parameters, but this might be known under a different name.
When parsing my input arguments, I want to have an option to include things like a
-v
argument, which version parsed, will print out the version number of my command line tool. In addition, I want to be able to have verbs for doing specific pieces of functionality, liketransform
, and then have additional arguments for this command.Individually, I can get this to work, i.e. have an
Option
for-v
, and have aVerbOption
fortransform
, however, I don't seem to be able to combine them. Am I missing something?So to recap, what I would like to be able to do is:
my.exe -v
my.exe transform -i "c:/temp/input.xml" -o "c:/temp/output.html"
Is this possible?
Each time I try it, my Version
Option
is always false.NOTE: I am using CommandLineParser 1.9.71.
The text was updated successfully, but these errors were encountered: