/
show.go
29 lines (25 loc) · 678 Bytes
/
show.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package context
import (
"fmt"
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"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 {
runShow(dockerCli)
return nil
},
ValidArgsFunction: completion.NoComplete,
}
return cmd
}
func runShow(dockerCli command.Cli) {
fmt.Fprintln(dockerCli.Out(), dockerCli.CurrentContext())
}