2022-04-25 04:52:18 -04:00
|
|
|
package context
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/docker/cli/cli"
|
|
|
|
"github.com/docker/cli/cli/command"
|
2022-03-30 09:27:25 -04:00
|
|
|
"github.com/docker/cli/cli/command/completion"
|
2022-04-25 04:52:18 -04:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
// newShowCommand creates a new cobra.Command for `docker context sow`
|
|
|
|
func newShowCommand(dockerCli command.Cli) *cobra.Command {
|
|
|
|
cmd := &cobra.Command{
|
|
|
|
Use: "show",
|
|
|
|
Short: "Print the name of the current context",
|
|
|
|
Args: cli.NoArgs,
|
|
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
2022-11-04 11:12:28 -04:00
|
|
|
runShow(dockerCli)
|
|
|
|
return nil
|
2022-04-25 04:52:18 -04:00
|
|
|
},
|
2022-03-30 09:27:25 -04:00
|
|
|
ValidArgsFunction: completion.NoComplete,
|
2022-04-25 04:52:18 -04:00
|
|
|
}
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2022-11-04 11:12:28 -04:00
|
|
|
func runShow(dockerCli command.Cli) {
|
|
|
|
fmt.Fprintln(dockerCli.Out(), dockerCli.CurrentContext())
|
2022-04-25 04:52:18 -04:00
|
|
|
}
|