From 86b3d69c7158cf144abc933b2b828fc2e0f3fae6 Mon Sep 17 00:00:00 2001 From: aiordache Date: Mon, 8 Mar 2021 15:32:42 +0100 Subject: [PATCH] Forward `context export/import` to mobycli Signed-off-by: aiordache --- cli/cmd/context/context.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/cli/cmd/context/context.go b/cli/cmd/context/context.go index 7c73c9b90..53feffaaf 100644 --- a/cli/cmd/context/context.go +++ b/cli/cmd/context/context.go @@ -17,6 +17,7 @@ package context import ( + "github.com/docker/compose-cli/cli/mobycli" "github.com/spf13/cobra" ) @@ -35,7 +36,32 @@ func Command() *cobra.Command { useCommand(), inspectCommand(), updateCommand(), + exportCommand(), + importCommand(), ) return cmd } + +func exportCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "export", + Short: "Export a context to a tar or kubeconfig file", + Run: func(cmd *cobra.Command, args []string) { + mobycli.Exec(cmd.Root()) + }, + } + cmd.Flags().Bool("kubeconfig", false, "Export as a kubeconfig file") + return cmd +} + +func importCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "import", + Short: "Import a context from a tar or zip file", + Run: func(cmd *cobra.Command, args []string) { + mobycli.Exec(cmd.Root()) + }, + } + return cmd +}