Inject HelperSet in Context
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.
I think this feature is good, but how do we apply the HelperSet for deployment?
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');
}
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?
Yes. You can use in your deployment scripts where you have access to the context.
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.