DockerCLI/cli-plugins
Ian Campbell b8bfba8dc6
cli-plugins: fix when plugin does not use PersistentPreRun* hooks
This regressed in 3af168c7df ("Ensure plugins can use `PersistentPreRunE`
again.") but this wasn't noticed because the helloworld test plugin has it's
own `PersistentPreRunE` which has the effect of deferring the resolution of the
global variable. In the case where the hook isn't used the variable is resolved
during `newPluginCommand` which is before the global variable was set.

Initialize the plugin command with a stub function wrapping the call to the
(global) hook, this defers resolving the variable until after it has been set,
otherwise the initial value (`nil`) is used in the struct.

Signed-off-by: Ian Campbell <ijc@docker.com>
(cherry picked from commit af200f14ed)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-05-13 09:06:08 -07:00
..
examples/helloworld Ensure plugins can use PersistentPreRunE again. 2019-03-14 14:29:09 +00:00
manager cli-plugins: alias an existing allowed command (only builder for now) 2019-04-19 01:26:45 +00:00
plugin cli-plugins: fix when plugin does not use PersistentPreRun* hooks 2019-05-13 09:06:08 -07:00