You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cmd/sops/main.go
+26-6Lines changed: 26 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@ import (
4
4
"context"
5
5
encodingjson "encoding/json"
6
6
"fmt"
7
+
"io"
7
8
"net"
8
9
"net/url"
9
10
"os"
@@ -1374,8 +1375,8 @@ func main() {
1374
1375
},
1375
1376
{
1376
1377
Name: "set",
1377
-
Usage: `set a specific key or branch in the input document. value must be a json encoded string. eg. '/path/to/file ["somekey"][0] {"somevalue":true}'`,
1378
-
ArgsUsage: `file index value`,
1378
+
Usage: `set a specific key or branch in the input document. value must be a JSON encoded string, for example '/path/to/file ["somekey"][0] {"somevalue":true}', or a path if --value-file is used, or omitted if --value-stdin is used`,
1379
+
ArgsUsage: `file index [ value ]`,
1379
1380
Flags: append([]cli.Flag{
1380
1381
cli.StringFlag{
1381
1382
Name: "input-type",
@@ -1387,7 +1388,11 @@ func main() {
1387
1388
},
1388
1389
cli.BoolFlag{
1389
1390
Name: "value-file",
1390
-
Usage: "treat 'value' as a file to read the actual value from (avoids leaking secrets in process listings)",
1391
+
Usage: "treat 'value' as a file to read the actual value from (avoids leaking secrets in process listings). Mutually exclusive with --value-stdin",
1392
+
},
1393
+
cli.BoolFlag{
1394
+
Name: "value-stdin",
1395
+
Usage: "treat 'value' as a file to read the actual value from (avoids leaking secrets in process listings). Mutually exclusive with --value-file",
1391
1396
},
1392
1397
cli.IntFlag{
1393
1398
Name: "shamir-secret-sharing-threshold",
@@ -1411,8 +1416,17 @@ func main() {
1411
1416
ifc.Bool("verbose") {
1412
1417
logging.SetLevel(logrus.DebugLevel)
1413
1418
}
1414
-
ifc.NArg() !=3 {
1415
-
returncommon.NewExitError("Error: no file specified, or index and value are missing", codes.NoFileSpecified)
1419
+
ifc.Bool("value-file") &&c.Bool("value-stdin") {
1420
+
returncommon.NewExitError("Error: cannot use both --value-file and --value-stdin", codes.ErrorGeneric)
1421
+
}
1422
+
ifc.Bool("value-stdin") {
1423
+
ifc.NArg() !=2 {
1424
+
returncommon.NewExitError("Error: file specified, or index and value are missing. Need precisely 2 positional arguments since --value-stdin is used.", codes.NoFileSpecified)
1425
+
}
1426
+
} else {
1427
+
ifc.NArg() !=3 {
1428
+
returncommon.NewExitError("Error: no file specified, or index and value are missing. Need precisely 3 positional arguments.", codes.NoFileSpecified)
0 commit comments