Skip to content

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