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

Change CliScriptHelper to Use ConsoleHelper Instance #27

Open
AndyM84 opened this issue Sep 11, 2024 · 0 comments
Open

Change CliScriptHelper to Use ConsoleHelper Instance #27

AndyM84 opened this issue Sep 11, 2024 · 0 comments

Comments

@AndyM84
Copy link
Member

AndyM84 commented Sep 11, 2024

This isn't a 100% thing, but the more I'm using the CliScriptHelper the more I'm wondering if requiring every action to receive a ConsoleHelper dependency is just pointless dependency decoupling?

The way it works today:

$ch = new ConsoleHelper($argv);
$script = (new CliScriptHelper(
  "My Script",
  "What my script does"
))->addOption(
  "file",
  "f",
  "file",
  "Set a file",
  "Set a file to use"
);

$script->startScript($ch);
$opts = $script->getOptions($ch);

The question is, does it make more sense to change the above to be this?

$ch = new ConsoleHelper($argv);
$script = (new CliScriptHelper(
  $ch,
  "My Script",
  "What my script does"
))->addOption(
  "file",
  "f",
  "file",
  "Set a file",
  "Set a file to use"
);

$script->startScript();
$opts = $script->getOptions();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant