Files
docker-cli/cli/command/context/show.go
Sebastiaan van Stijn 2827d037ba cli/command/completion: deprecate NoComplete
This function was an exact duplicate of [cobra.NoFileCompletions], so
deprecating it in favor of that.

[cobra.NoFileCompletions]: https://pkg.go.dev/github.com/spf13/cobra@v1.9.1#NoFileCompletions

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-30 12:00:34 +02:00

29 lines
632 B
Go

package context
import (
"fmt"
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"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: cobra.NoFileCompletions,
}
return cmd
}
func runShow(dockerCli command.Cli) {
fmt.Fprintln(dockerCli.Out(), dockerCli.CurrentContext())
}