diff --git a/cmd/sops/main.go b/cmd/sops/main.go index 80f1f132e..58c38e350 100644 --- a/cmd/sops/main.go +++ b/cmd/sops/main.go @@ -189,11 +189,11 @@ func main() { }, cli.StringFlag{ Name: "input-type", - Usage: "currently json, yaml, dotenv and binary are supported. If not set, sops will use the file's extension to determine the type", + Usage: "currently ini, json, yaml, dotenv and binary are supported. If not set, sops will use the file's extension to determine the type", }, cli.StringFlag{ Name: "output-type", - Usage: "currently json, yaml, dotenv and binary are supported. If not set, sops will use the input file's extension to determine the output format", + Usage: "currently ini, json, yaml, dotenv and binary are supported. If not set, sops will use the input file's extension to determine the output format", }, cli.StringFlag{ Name: "filename", @@ -508,6 +508,10 @@ func main() { Name: "yes, y", Usage: `pre-approve all changes and run non-interactively`, }, + cli.StringFlag{ + Name: "input-type", + Usage: "currently ini, json, yaml, dotenv and binary are supported. If not set, sops will use the file's extension to determine the type", + }, }, keyserviceFlags...), Action: func(c *cli.Context) error { var err error @@ -529,6 +533,7 @@ func main() { 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 diff --git a/cmd/sops/subcommand/updatekeys/updatekeys.go b/cmd/sops/subcommand/updatekeys/updatekeys.go index 143bcfe60..2b00989c0 100644 --- a/cmd/sops/subcommand/updatekeys/updatekeys.go +++ b/cmd/sops/subcommand/updatekeys/updatekeys.go @@ -19,6 +19,7 @@ type Opts struct { KeyServices []keyservice.KeyServiceClient Interactive bool ConfigPath string + InputType string } // UpdateKeys update the keys for a given file @@ -39,7 +40,7 @@ func UpdateKeys(opts Opts) error { } func updateFile(opts Opts) error { - store := common.DefaultStoreForPath(opts.InputPath) + store := common.DefaultStoreForPathOrFormat(opts.InputPath, opts.InputType) log.Printf("Syncing keys for file %s", opts.InputPath) tree, err := common.LoadEncryptedFile(store, opts.InputPath) if err != nil {