Simple check to differentiate between stdin flag or value that contains

a -
pull/2533/head
mckennajones 8 years ago
parent 4ed6770cfa
commit 40a8f13cd9

@ -229,8 +229,12 @@ func (c *KVPutCommand) dataFromArgs(args []string) (string, string, error) {
return key, string(data), nil
case '-':
var b bytes.Buffer
if _, err := io.Copy(&b, stdin); err != nil {
return "", "", fmt.Errorf("Failed to read stdin: %s", err)
if len(data) > 1 {
return key, data, nil
} else {
if _, err := io.Copy(&b, stdin); err != nil {
return "", "", fmt.Errorf("Failed to read stdin: %s", err)
}
}
return key, b.String(), nil
default:

Loading…
Cancel
Save