We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
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); }
[Command(Description = "This is a sample application")] public void Hello([Argument(Description = "Your name")] string name, [Option("upper", shortNames: ['u'], Description = "Print a name converted to upper-case.")] bool toUpperCase = true) { Console.WriteLine($"Hello {(toUpperCase ? name.ToUpper() : name)}!"); }
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.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
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.
The text was updated successfully, but these errors were encountered: