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,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…
Reference in New Issue