mirror of https://github.com/status-im/consul.git
Simple check to differentiate between stdin flag or value that contains
a -
This commit is contained in:
parent
4ed6770cfa
commit
40a8f13cd9
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue