Required MutuallyExclusiveSet

Feb 23, 2012 at 6:15 PM

Hi,

thanks for this library!

 

Is there a way to specify a Required MutuallyExclusiveSet?

meaning that one of the mutually exclusive options is required.

 

Thanks,

Alessandro Pilotti

[MVP Asp.Net / IIS]

May 14, 2012 at 8:42 AM
Hi,
requiring an option to be present, in my opinion, goes against defining such option mutually exclusive with another.

Think again your command line input specification...

Or please made me an example of what you want to get in more detail.

Regards,
Giacomo


2012/2/23 alexp <notifications@codeplex.com>

From: alexp

Hi,

thanks for this library!

Is there a way to specify a Required MutuallyExclusiveSet?

meaning that one of the mutually exclusive options is required.

Thanks,

Alessandro Pilotti

[MVP Asp.Net / IIS]

Read the full discussion online.

To add a post to this discussion, reply to this email (commandline@discussions.codeplex.com)

To start a new discussion for this project, email commandline@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


May 16, 2012 at 11:59 AM

I just started to use the library so I could have missed something but here is what could be a valid example. The program that I am developing has both a GUI and a command line execution. Launching the GUI is done via a command line option.

I would therefore like to have required options in case the program is executing in command line mode.

I thought that I would be able to do so by combining the MutuallyExclusiveSet and Required attributes as shown below. Basically, I would want Option 1 and Option 2 to be required if the option "Gui" is not set. Again, I just started and I am not sure I understand properly the concept of "MutuallyExclusiveSet".

public class CommandLineOptions : CommandLineOptionsBase
{
	[Option(null, "gui", Required = false, HelpText = "Launch the GUI", MutuallyExclusiveSet = "Gui")]
	public bool Gui { get; set; }

	[Option(null, "opt1", HelpText = "Option 1", MutuallyExclusiveSet = "CommandLine", Required = true)]
	public string Option1 { get; set; }
	
	[Option(null, "opt2", HelpText = "Option 2", MutuallyExclusiveSet = "CommandLine", Required = true)]
	public string Option2 { get; set; }
}

I saw some threads about "Condition" and this could be more in sync with what I am trying to achieve. Potentially, the easiest way of doing so would be to manually performs the check, but was just curious to know if the library is not supporting it.

May 16, 2012 at 7:38 PM
Hi Jacobs,
can you post this problem on stackoverflow.com.

I'll try to help you, but in this way other users will benefit this knowledge.

If this is not a problem for you... If so it's I'll reply in private way.

Regards,
Giacomo

PS: If you do this don't talk directly to me in the question, just email me the link so I can reply you there.

2012/5/16 jjacobs <notifications@codeplex.com>

From: jjacobs

I just started to use the library so I could have missed something but here is what could be a valid example. The program that I am developing has both a GUI and a command line execution. Launching the GUI is done via a command line option.

I would therefore like to have required options in case the program is executing in command line mode.

I thought that I would be able to do so by combining the MutuallyExclusiveSet and Required attributes as shown below. Basically, I would want Option 1 and Option 2 to be required if the option "Gui" is not set. Again, I just started and I am not sure I understand properly the concept of "MutuallyExclusiveSet".

public class CommandLineOptions : CommandLineOptionsBase
{
	[Option(null, "gui", Required = false, HelpText = "Launch the GUI", MutuallyExclusiveSet = "Gui")]
	public bool Gui { get; set; }

	[Option(null, "opt1", HelpText = "Option 1", MutuallyExclusiveSet = "CommandLine", Required = true)]
	public string Option1 { get; set; }
	
	[Option(null, "opt2", HelpText = "Option 2", MutuallyExclusiveSet = "CommandLine", Required = true)]
	public string Option2 { get; set; }
}

I saw some threads about "Condition" and this could be more in sync with what I am trying to achieve. Potentially, the easiest way of doing so would be to manually performs the check, but was just curious to know if the library is not supporting it.

Read the full discussion online.

To add a post to this discussion, reply to this email (commandline@discussions.codeplex.com)

To start a new discussion for this project, email commandline@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


May 17, 2012 at 5:08 PM

Thank you Giacomo for your reply!

I posted my question on stackoverflow.com as you suggested.

http://stackoverflow.com/questions/10639320/c-sharp-command-line-parser-with-mutually-exclusive-required-parameters

May 27, 2012 at 4:15 PM

Checkout the reply...

Regards,
Giacomo