Non-optional un-named options

Jul 4, 2012 at 4:12 PM
Edited Jul 4, 2012 at 4:19 PM

I'm using your library (great work, by the way!) to, essentially, wrap a web service rest api in a command line tool. I wanted to adopt the ssh syntax for options, making the synopsis of my tool looking something like this:

Usage: foo.exe [-ov] [username:password@]hostname

However, there seem to be no concept in the parser to specify these unnamed options at the end. My workaround is to define the following property in my implementation of CommandLineOptionsBase:

// every argument except for the named ones will be written to this property
public IList AdditionalArguments { get; set; }

Then, manually make sure that its Count is greater than one. But I havent really figured out a way to communicate this to the user. I currenty print a hardcoded synopsis:

// make sure a host was specified
if (options.AdditionalArguments.Count < 1)
    Console.WriteLine("Usage: foo.exe [-ov] [username:password@]hostname");

Whats your take on this "ssh like syntax"?

Edit: Sorry for the formatting. I really did try but I cannot, for everything that is dear to me, figure out how this box wants me to type. (Whats so wrong with markdown?)

Edit2: Found the magic button and could rewrite the html by hand.

Feb 24, 2013 at 5:29 AM
It's not old post... Now you're a main contributor... Or you're another @mizipzor? :)))
May 21, 2013 at 3:22 AM
What is the status of this? Is there any update how to get Non-optional un-named arguments?