Skip to content
New issue

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

Add option conflict feature #8

Open
jjulien opened this issue Dec 15, 2017 · 0 comments
Open

Add option conflict feature #8

jjulien opened this issue Dec 15, 2017 · 0 comments

Comments

@jjulien
Copy link
Owner

jjulien commented Dec 15, 2017

Allow the user to specify one or more options that conflict with each other. For example, a script may have a verbose option and a quiet option. A user providing both of these options would be in conflict.

/**
 * @var CLIHelper\Helper $option
 */
// Working directly with option
$option->addOptionConflict($option)

// Working CLIHelper\OptionBuilder using the CLIHelper\Helper
$helper->newOption()
  ->withName("verbose")
  ->withLong("verbose")
  ->withShort("v")
  ->withConflict($option)
  ->build()

// Adding multiple conflicts using CLIHelper\Helper
$helper->newOption()
  ->withName("verbose")
  ->withLong("verbose")
  ->withShort("v")
  ->withConflicts(array($option1, $option2))
  ->build()

The user should only have to tell one option that it conflicts with another. The helper should take care of making sure both options know they have a conflict with the other.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant