From 674d54ad9bb1fc049188b61f450b3bcd2c4fbb74 Mon Sep 17 00:00:00 2001 From: Hitoshi Mitake Date: Tue, 9 Feb 2016 12:22:25 +0900 Subject: [PATCH] etcdctlv3: handle a case of 0 arguments in put command --- etcdctlv3/command/put_command.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/etcdctlv3/command/put_command.go b/etcdctlv3/command/put_command.go index 36d92a562..3b97bedbe 100644 --- a/etcdctlv3/command/put_command.go +++ b/etcdctlv3/command/put_command.go @@ -55,6 +55,10 @@ will store the content of the file to . // putCommandFunc executes the "put" command. func putCommandFunc(cmd *cobra.Command, args []string) { + if len(args) == 0 { + ExitWithError(ExitBadArgs, fmt.Errorf("put command needs 1 argument and input from stdin or 2 arguments.")) + } + key := []byte(args[0]) value, err := argOrStdin(args, os.Stdin, 1) if err != nil {