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

Update Druplicon hook and ExampleCommandFile to new hook APIs #2370

Merged
merged 3 commits into from
Oct 3, 2016

Conversation

greg-1-anderson
Copy link
Member

Making the master branch like #2366

Copy link
Member

@weitzman weitzman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I reviewed this PR earlier but didn't submit it. Getting used to Github's new system.

{
if ($args['options']['french']) {
if ($commandData->input()->getOption('french')) {
Copy link
Member

@weitzman weitzman Oct 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming here feels a little off. My impression from the name CommandData is that it refers to a command definition. If I wanted to learn info about the current request I would go to Request->getOptions() or similar. I could see Request->getCommandInfo() as a way to fetch the current command definition.

Having said that, its a minor point, and you gave already released annotated-command so no need to act on this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CommandData is only used in the hook system; there are no other clients of that, so I could bend the semver and change its name in 2.1.0 and it wouldn't hurt anything.

CommandData includes information about the command for a hook. The information it includes is the Input object (which is where getOption() comes from -- Symfony's InputInterface::getOption()), the Output object, and the annotation data, which includes the command name, but does not include the entire command record.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK thanks. There may be no need to change the name then ... Do you think that --druplicon should write to Output object instead of drush_print(). --druplicon is a silly edge case so maybe we just dont worry about it.

return;
}
drush_log(dt('Displaying Druplicon for "!command" command.', array('!command' => $commandName)));
if ($commandData->input()->getOption('druplicon')) {
Copy link
Member

@weitzman weitzman Oct 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is the new drush_get_option(). Excited to see how command configuration gets wired into this system.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robo already has a Config object that can be passed in to a command handler via dependency injection. I intend to make a system similar to Drush's current procedural system that will just set the option values directly on the $input object, so a command object would only need to have the Config object injected if it needed access to more than just its command args and options.

@greg-1-anderson
Copy link
Member Author

Oh, changes approved -- guess I'll merge. Still getting used to the new GitHub system too.

@greg-1-anderson greg-1-anderson merged commit 5d6bf50 into master Oct 3, 2016
@weitzman weitzman deleted the hook-apis branch July 17, 2018 13:40
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

Successfully merging this pull request may close these issues.

2 participants