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

Inject HelperSet in Context #111

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Inject HelperSet in Context #111

wants to merge 2 commits into from

Conversation

stevro
Copy link

@stevro stevro commented Mar 2, 2020

I have injected the HelperSet into Context to allow the use of QuestionHelper during the deploy.
One use case is when you want the deploy script to ask for a confirmation or from input at runtime.

@fd6130
Copy link

fd6130 commented Nov 12, 2021

I think this feature is good, but how do we apply the HelperSet for deployment?

@stevro
Copy link
Author

stevro commented Nov 12, 2021

I'm not sure I understand your question.
I attach a sample of code for using it in your deploy:

   $helper = $this->getContext()->getHelperSet('question');

    $question = new ConfirmationQuestion('Continue with this action?', false);

    if (!$helper->ask($this->getContext()->getInput(), $this->getContext()->getOutput(), $question)) {
        $this->log('Exit');
        throw new \Exception('Deployment stopped');
    }

@fd6130
Copy link

fd6130 commented Nov 12, 2021

I'm not sure I understand your question. I attach a sample of code for using it in your deploy:

   $helper = $this->getContext()->getHelperSet('question');

    $question = new ConfirmationQuestion('Continue with this action?', false);

    if (!$helper->ask($this->getContext()->getInput(), $this->getContext()->getOutput(), $question)) {
        $this->log('Exit');
        throw new \Exception('Deployment stopped');
    }

Cool, that's mean we can use it in some hook method such as beforeFinishingDeploy(). Am i right?

@stevro
Copy link
Author

stevro commented Nov 12, 2021

Yes. You can use in your deployment scripts where you have access to the context.

@fd6130
Copy link

fd6130 commented Nov 12, 2021

Yes. You can use in your deployment scripts where you have access to the context.

Thanks. I think i will merge this into my fork instead because this repo not so active in merging PR anymore.

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