diff --git a/cmd/docker-app/main.go b/cmd/docker-app/main.go index 51a0e5965..99fdbaa01 100644 --- a/cmd/docker-app/main.go +++ b/cmd/docker-app/main.go @@ -2,6 +2,7 @@ package main import ( "github.com/docker/app/internal" + app "github.com/docker/app/internal/commands" "github.com/docker/cli/cli-plugins/manager" "github.com/docker/cli/cli-plugins/plugin" "github.com/docker/cli/cli/command" @@ -10,7 +11,7 @@ import ( func main() { plugin.Run(func(dockerCli command.Cli) *cobra.Command { - return newRootCmd(dockerCli) + return app.NewRootCmd("app", dockerCli) }, manager.Metadata{ SchemaVersion: "0.1.0", Vendor: "Docker Inc.", diff --git a/cmd/docker-app/bundle.go b/internal/commands/bundle.go similarity index 99% rename from cmd/docker-app/bundle.go rename to internal/commands/bundle.go index f9b90c17c..4d2b8a314 100644 --- a/cmd/docker-app/bundle.go +++ b/internal/commands/bundle.go @@ -1,4 +1,4 @@ -package main +package commands import ( "bytes" diff --git a/cmd/docker-app/bundle_test.go b/internal/commands/bundle_test.go similarity index 98% rename from cmd/docker-app/bundle_test.go rename to internal/commands/bundle_test.go index 22014d15b..6481d38cc 100644 --- a/cmd/docker-app/bundle_test.go +++ b/internal/commands/bundle_test.go @@ -1,4 +1,4 @@ -package main +package commands import ( "testing" diff --git a/cmd/docker-app/cnab.go b/internal/commands/cnab.go similarity index 99% rename from cmd/docker-app/cnab.go rename to internal/commands/cnab.go index 0a54ddbc9..ff9f130b9 100644 --- a/cmd/docker-app/cnab.go +++ b/internal/commands/cnab.go @@ -1,4 +1,4 @@ -package main +package commands import ( "fmt" diff --git a/cmd/docker-app/completion.go b/internal/commands/completion.go similarity index 99% rename from cmd/docker-app/completion.go rename to internal/commands/completion.go index 5daadcf53..9e573ab27 100644 --- a/cmd/docker-app/completion.go +++ b/internal/commands/completion.go @@ -1,4 +1,4 @@ -package main +package commands import ( "bytes" diff --git a/cmd/docker-app/init.go b/internal/commands/init.go similarity index 98% rename from cmd/docker-app/init.go rename to internal/commands/init.go index 68d51230c..e26847010 100644 --- a/cmd/docker-app/init.go +++ b/internal/commands/init.go @@ -1,4 +1,4 @@ -package main +package commands import ( "github.com/docker/app/internal/packager" diff --git a/cmd/docker-app/inspect.go b/internal/commands/inspect.go similarity index 98% rename from cmd/docker-app/inspect.go rename to internal/commands/inspect.go index b464587d3..9c6bffc4c 100644 --- a/cmd/docker-app/inspect.go +++ b/internal/commands/inspect.go @@ -1,4 +1,4 @@ -package main +package commands import ( "github.com/deislabs/duffle/pkg/action" diff --git a/cmd/docker-app/install.go b/internal/commands/install.go similarity index 99% rename from cmd/docker-app/install.go rename to internal/commands/install.go index 92e5a6452..4414919ce 100644 --- a/cmd/docker-app/install.go +++ b/internal/commands/install.go @@ -1,4 +1,4 @@ -package main +package commands import ( "fmt" diff --git a/cmd/docker-app/merge.go b/internal/commands/merge.go similarity index 99% rename from cmd/docker-app/merge.go rename to internal/commands/merge.go index 304947466..3903ed824 100644 --- a/cmd/docker-app/merge.go +++ b/internal/commands/merge.go @@ -1,4 +1,4 @@ -package main +package commands import ( "fmt" diff --git a/cmd/docker-app/parameters.go b/internal/commands/parameters.go similarity index 99% rename from cmd/docker-app/parameters.go rename to internal/commands/parameters.go index 5a42d607c..a1a6558ae 100644 --- a/cmd/docker-app/parameters.go +++ b/internal/commands/parameters.go @@ -1,4 +1,4 @@ -package main +package commands import ( "fmt" diff --git a/cmd/docker-app/parameters_test.go b/internal/commands/parameters_test.go similarity index 99% rename from cmd/docker-app/parameters_test.go rename to internal/commands/parameters_test.go index a926d4f4d..ac7a3f744 100644 --- a/cmd/docker-app/parameters_test.go +++ b/internal/commands/parameters_test.go @@ -1,4 +1,4 @@ -package main +package commands import ( "testing" diff --git a/cmd/docker-app/pull.go b/internal/commands/pull.go similarity index 95% rename from cmd/docker-app/pull.go rename to internal/commands/pull.go index 1e1275577..77642e5e4 100644 --- a/cmd/docker-app/pull.go +++ b/internal/commands/pull.go @@ -1,4 +1,4 @@ -package main +package commands import ( "github.com/docker/app/internal/packager" diff --git a/cmd/docker-app/push.go b/internal/commands/push.go similarity index 97% rename from cmd/docker-app/push.go rename to internal/commands/push.go index a6a39e80b..1b68af15f 100644 --- a/cmd/docker-app/push.go +++ b/internal/commands/push.go @@ -1,4 +1,4 @@ -package main +package commands import ( "fmt" diff --git a/cmd/docker-app/render.go b/internal/commands/render.go similarity index 99% rename from cmd/docker-app/render.go rename to internal/commands/render.go index 71f28e703..79de0096d 100644 --- a/cmd/docker-app/render.go +++ b/internal/commands/render.go @@ -1,4 +1,4 @@ -package main +package commands import ( "fmt" diff --git a/cmd/docker-app/root.go b/internal/commands/root.go similarity index 87% rename from cmd/docker-app/root.go rename to internal/commands/root.go index 39b96cbc1..2468e1193 100644 --- a/cmd/docker-app/root.go +++ b/internal/commands/root.go @@ -1,4 +1,4 @@ -package main +package commands import ( "io/ioutil" @@ -9,19 +9,17 @@ import ( "github.com/spf13/pflag" ) -// rootCmd represents the base command when called without any subcommands -// FIXME(vdemeester) use command.Cli interface -func newRootCmd(dockerCli command.Cli) *cobra.Command { +// NewRootCmd returns the base root command. +func NewRootCmd(use string, dockerCli command.Cli) *cobra.Command { cmd := &cobra.Command{ - Use: "app", Short: "Docker Application Packages", Long: `Build and deploy Docker Application Packages.`, + Use: use, } addCommands(cmd, dockerCli) return cmd } -// addCommands adds all the commands from cli/command to the root command func addCommands(cmd *cobra.Command, dockerCli command.Cli) { cmd.AddCommand( installCmd(dockerCli), diff --git a/cmd/docker-app/split.go b/internal/commands/split.go similarity index 98% rename from cmd/docker-app/split.go rename to internal/commands/split.go index fca59fed6..54e637fad 100644 --- a/cmd/docker-app/split.go +++ b/internal/commands/split.go @@ -1,4 +1,4 @@ -package main +package commands import ( "github.com/docker/app/internal/packager" diff --git a/cmd/docker-app/status.go b/internal/commands/status.go similarity index 98% rename from cmd/docker-app/status.go rename to internal/commands/status.go index d51fb5329..43f428cb9 100644 --- a/cmd/docker-app/status.go +++ b/internal/commands/status.go @@ -1,4 +1,4 @@ -package main +package commands import ( "github.com/deislabs/duffle/pkg/action" diff --git a/cmd/docker-app/uninstall.go b/internal/commands/uninstall.go similarity index 98% rename from cmd/docker-app/uninstall.go rename to internal/commands/uninstall.go index f49cd44d4..35b89d7e8 100644 --- a/cmd/docker-app/uninstall.go +++ b/internal/commands/uninstall.go @@ -1,4 +1,4 @@ -package main +package commands import ( "fmt" diff --git a/cmd/docker-app/upgrade.go b/internal/commands/upgrade.go similarity index 99% rename from cmd/docker-app/upgrade.go rename to internal/commands/upgrade.go index b2273af7e..191171459 100644 --- a/cmd/docker-app/upgrade.go +++ b/internal/commands/upgrade.go @@ -1,4 +1,4 @@ -package main +package commands import ( "fmt" diff --git a/cmd/docker-app/validate.go b/internal/commands/validate.go similarity index 98% rename from cmd/docker-app/validate.go rename to internal/commands/validate.go index e74f7be1b..97581a25f 100644 --- a/cmd/docker-app/validate.go +++ b/internal/commands/validate.go @@ -1,4 +1,4 @@ -package main +package commands import ( "github.com/docker/app/internal/packager" diff --git a/cmd/docker-app/version.go b/internal/commands/version.go similarity index 95% rename from cmd/docker-app/version.go rename to internal/commands/version.go index b4c47c6a7..3b3c99011 100644 --- a/cmd/docker-app/version.go +++ b/internal/commands/version.go @@ -1,4 +1,4 @@ -package main +package commands import ( "fmt"