Throw if file and args secrets are used on secret set command

This commit is contained in:
carlosmonastyrski
2025-03-18 09:58:10 -03:00
parent d4842dd273
commit ad6f285b59

View File

@@ -145,7 +145,10 @@ var secretsSetCmd = &cobra.Command{
DisableFlagsInUseLine: true,
Args: func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("file") {
return cobra.ExactArgs(0)(cmd, args)
if len(args) > 0 {
return fmt.Errorf("secrets cannot be provided as command-line arguments when the --file option is used. Please choose either file-based or argument-based secret input")
}
return nil
}
return cobra.MinimumNArgs(1)(cmd, args)
},