Simple check to differentiate between stdin flag or value that contains

a -
This commit is contained in:
mckennajones 2016-11-27 12:55:14 -08:00
parent 4ed6770cfa
commit 40a8f13cd9
1 changed files with 6 additions and 2 deletions

View File

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