1

I have a drush command that does some stuff and at the end of its execution I want to invoke twig-compile --uri=foobar.com. When I call drush_invoke('twig-compile') I get error about unknown arguments(those were passed to my drush command). I tried things like this before invoking the command drush_set_context('options', ['uri', 'foobar.com']); but no success yet.

How should I reset the options so twigc won't complain about them or how do I invoke the twigc command directly with the uri argument?

1

If you use drush_invoke, you should first use drush_set_option('strict', FALSE); to turn off strict option checking for the subcommand. drush_invoke runs a subcommand in the same process, which can be more efficient; however, there are a number of ways that this can go wrong, so it is often better to use drush_invoke_process instead, to run the subcommand in its own process. If you do this, there is no need to disable strict option handling.

drush_invoke_process('@self', 'twig-compile', $args, $options);.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy