github.com/khulnasoft/cli@v0.0.0-20240402070845-01bcad7beefa/cli/command/context/show.go (about)

     1  package context
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/khulnasoft/cli/cli"
     7  	"github.com/khulnasoft/cli/cli/command"
     8  	"github.com/khulnasoft/cli/cli/command/completion"
     9  	"github.com/spf13/cobra"
    10  )
    11  
    12  // newShowCommand creates a new cobra.Command for `docker context sow`
    13  func newShowCommand(dockerCli command.Cli) *cobra.Command {
    14  	cmd := &cobra.Command{
    15  		Use:   "show",
    16  		Short: "Print the name of the current context",
    17  		Args:  cli.NoArgs,
    18  		RunE: func(cmd *cobra.Command, args []string) error {
    19  			runShow(dockerCli)
    20  			return nil
    21  		},
    22  		ValidArgsFunction: completion.NoComplete,
    23  	}
    24  	return cmd
    25  }
    26  
    27  func runShow(dockerCli command.Cli) {
    28  	fmt.Fprintln(dockerCli.Out(), dockerCli.CurrentContext())
    29  }