Skip to content

Commit

Permalink
Allow to pass multple paths to 'updatekeys'
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Jürgensmeyer <Simon.Juergensmeyer@gmail.com>
  • Loading branch information
sj14 committed Sep 11, 2023
1 parent 7b3a032 commit 0cde35a
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions cmd/sops/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ func main() {
},
{
Name: "updatekeys",
Usage: "update the keys of a SOPS file using the config file",
Usage: "update the keys of SOPS files using the config file",
ArgsUsage: `file`,
Flags: append([]cli.Flag{
cli.BoolFlag{
Expand All @@ -528,18 +528,20 @@ func main() {
if c.NArg() < 1 {
return common.NewExitError("Error: no file specified", codes.NoFileSpecified)
}
err = updatekeys.UpdateKeys(updatekeys.Opts{
InputPath: c.Args()[0],
GroupQuorum: c.Int("shamir-secret-sharing-quorum"),
KeyServices: keyservices(c),
Interactive: !c.Bool("yes"),
ConfigPath: configPath,
InputType: c.String("input-type"),
})
if cliErr, ok := err.(*cli.ExitError); ok && cliErr != nil {
return cliErr
} else if err != nil {
return common.NewExitError(err, codes.ErrorGeneric)
for _, path := range c.Args() {
err = updatekeys.UpdateKeys(updatekeys.Opts{
InputPath: path,
GroupQuorum: c.Int("shamir-secret-sharing-quorum"),
KeyServices: keyservices(c),
Interactive: !c.Bool("yes"),
ConfigPath: configPath,
InputType: c.String("input-type"),
})
if cliErr, ok := err.(*cli.ExitError); ok && cliErr != nil {
return cliErr
} else if err != nil {
return common.NewExitError(err, codes.ErrorGeneric)
}
}
return nil
},
Expand Down

0 comments on commit 0cde35a

Please sign in to comment.