Micro-framework for .NET console application. Cocona makes it easy and fast to build console applications on .NET.
3.26k
stars
85
forks
source link
Option shortname does not allow bool parameter to be supplied as false #125
Open
sorenhnielsen opened 8 months ago
Trying to add an option of type bool with a shortname. The fullname of the option parse the bool parameter correct while the shortname is always true.
Example from Samples, modified
using Cocona;
namespace CoconaSample.GettingStarted.TypicalSimpleApp;
class Program { static void Main(string[] args) { CoconaApp.Run(args);
}
}
Changed Option to have a Name 'upper' and have a default value of true.
Usage: CoconaSample.GettingStarted.TypicalSimpleApp.exe "name" --upper=true returns: Hello NAME
CoconaSample.GettingStarted.TypicalSimpleApp.exe "name" --upper=false returns: Hello name
CoconaSample.GettingStarted.TypicalSimpleApp.exe "name" -u true return Hello NAME
CoconaSample.GettingStarted.TypicalSimpleApp.exe "name" -u false return Hello NAME <-- would expect 'Hello name' here
If seems like Shortnames just returns bool based on if the parameter is there, meaning it is not possible to supply false with the parameter.
Would expect the shortname to allow the parameter to be set to true/false depending on what is supplied.