Nov 16, 2012 at 3:56 PM

It's not clear to me how you can use a command line argument as a switch, where its presence indicates a true and its absence equals a false.  How does that work?

Feb 24, 2013 at 5:55 AM
Edited Feb 24, 2013 at 5:55 AM
Hi @jholovacs,
this is the way unix command line parsing specification is defined.

For short:
[Option('f', "filename")]
public string FileName { get; set; }

[Option('x', "to-excel")]
public bool ConvertToExcel { get; set; }
Leads to:
app --filename myfile.csv --to-excel

app -fmyfile.cvs

app -xf myfile.csv
are all valid combinations.

When an option is boolean (a switch) if you omit it as in #2 ConvertToExcel will be false, when present as in #1 and #3 ConvertToExcel will be true.

This document is a bit old, but still correct: http://commandline.codeplex.com/wikipage?title=Input%20Specification&referringTitle=Home

Regards, Giacomo