etcdctl/ctlv3/command/get_command.go
func getCommandFunc(cmd *cobra.Command, args []string) {
	key, opts := getGetOp(args)
	ctx, cancel := commandCtx(cmd)
	resp, err := mustClientFromCmd(cmd).Get(ctx, key, opts...)
	cancel()
	if err != nil {
		ExitWithError(ExitError, err)
	}

	if printValueOnly {
		dp, simple := (display).(*simplePrinter)
		if !simple {
			ExitWithError(ExitBadArgs, fmt.Errorf("print-value-only is only for `--write-out=simple`"))
		}
		dp.valueOnly = true
	}
	display.Get(*resp)
}
func getCommandFunc(cmd *cobra.Command, args []string) {
	key, opts := getGetOp(args)
	ctx, cancel := commandCtx(cmd)
	resp, err := mustClientFromCmd(cmd).Get(ctx, key, opts...)
	cancel()
	if err != nil {
		ExitWithError(ExitError, err)
	}

	if printValueOnly {
		dp, simple := (display).(*simplePrinter)
		if !simple {
			ExitWithError(ExitBadArgs, fmt.Errorf("print-value-only is only for `--write-out=simple`"))
		}
		dp.valueOnly = true
	}
	display.Get(*resp)
}
func getCommandFunc ( cmd * cobra . Command , args [ ] string ) { key , opts := getGetOp ( args ) ctx , cancel := commandCtx ( cmd ) resp , err := mustClientFromCmd ( cmd ) . Get ( ctx , key , opts ... ) cancel ( ) if err != nil { ExitWithError ( ExitError , err ) } if printValueOnly { dp , simple := ( display ) . ( * simplePrinter ) if ! simple { ExitWithError ( ExitBadArgs , fmt . Errorf ( " " ) ) } dp . valueOnly = true } display . Get ( * resp ) }
// getCommandFunc executes the "get" command.
getCommandFunc executes the get command .