Skip to content

Inject HelperSet in Context#111

Open
stevro wants to merge 2 commits into
EasyCorp:masterfrom
stevro:master
Open

Inject HelperSet in Context#111
stevro wants to merge 2 commits into
EasyCorp:masterfrom
stevro:master

Conversation

@stevro

@stevro stevro commented Mar 2, 2020

Copy link
Copy Markdown

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

fd6130 commented Nov 12, 2021

Copy link
Copy Markdown

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

@stevro

stevro commented Nov 12, 2021

Copy link
Copy Markdown
Author

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

fd6130 commented Nov 12, 2021

Copy link
Copy Markdown

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

stevro commented Nov 12, 2021

Copy link
Copy Markdown
Author

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

@fd6130

fd6130 commented Nov 12, 2021

Copy link
Copy Markdown

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