Move workflow to its own package
This causes the workflow command to have the same capabilities and restrictions as any other plugin.
This commit is contained in:
parent
09f1995485
commit
3329e193d0
|
@ -3,18 +3,15 @@ package cmd
|
|||
import (
|
||||
"io"
|
||||
|
||||
// "github.com/ian-howell/exampleplugin"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/ian-howell/airshipctl/cmd/workflow"
|
||||
|
||||
// "github.com/ian-howell/exampleplugin"
|
||||
)
|
||||
|
||||
// builtinPlugins are the plugins that are built and maintained by the
|
||||
// airshipctl team. They may be disabled if desired
|
||||
var builtinPlugins = []func(io.Writer, []string) *cobra.Command{
|
||||
NewWorkflowCommand,
|
||||
}
|
||||
|
||||
// externalPlugins are external. The function to create a command should be
|
||||
// placed here
|
||||
var externalPlugins = []func(io.Writer, []string) *cobra.Command{
|
||||
// pluginCommands are the functions that create the entrypoint command for a plugin
|
||||
var pluginCommands = []func(io.Writer, []string) *cobra.Command{
|
||||
// exampleplugin.NewExampleCommand, // This is an example and shouldn't be enabled in production builds
|
||||
workflow.NewWorkflowCommand,
|
||||
}
|
||||
|
|
|
@ -47,14 +47,9 @@ func Execute(out io.Writer) {
|
|||
}
|
||||
}
|
||||
|
||||
// loadPluginCommands finds all of the plugins in the builtinPlugins and
|
||||
// externalPlugins datastructures, and loads them as subcommands to cmd
|
||||
// loadPluginCommands loads all of the plugins as subcommands to cmd
|
||||
func loadPluginCommands(cmd *cobra.Command, out io.Writer, args []string) {
|
||||
for _, subcmd := range builtinPlugins {
|
||||
cmd.AddCommand(subcmd(out, args))
|
||||
}
|
||||
|
||||
for _, subcmd := range externalPlugins {
|
||||
for _, subcmd := range pluginCommands {
|
||||
cmd.AddCommand(subcmd(out, args))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package cmd
|
||||
package workflow
|
||||
|
||||
import (
|
||||
"io"
|
|
@ -1,4 +1,4 @@
|
|||
package cmd
|
||||
package workflow
|
||||
|
||||
import (
|
||||
"fmt"
|
|
@ -1,4 +1,4 @@
|
|||
package cmd
|
||||
package workflow
|
||||
|
||||
import (
|
||||
"fmt"
|
Loading…
Reference in New Issue