Do not allow positional arguments when running gitops (#32780)
For #32478 Added check to gitops command to throw error if positional arguments are detected.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
* Added check to gitops command to throw error if positional arguments are detected.
|
||||
@@ -60,6 +60,14 @@ func gitopsCommand() *cli.Command {
|
||||
debugFlag(),
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logf := func(format string, a ...interface{}) {
|
||||
_, _ = fmt.Fprintf(c.App.Writer, format, a...)
|
||||
}
|
||||
|
||||
if len(c.Args().Slice()) != 0 {
|
||||
return errors.New("No positional arguments are allowed. To load multiple config files, use one -f flag per file.")
|
||||
}
|
||||
|
||||
totalFilenames := len(flFilenames.Value())
|
||||
if totalFilenames == 0 {
|
||||
return errors.New("-f must be specified")
|
||||
@@ -85,9 +93,6 @@ func gitopsCommand() *cli.Command {
|
||||
if appConfig.License == nil {
|
||||
return errors.New("no license struct found in app config")
|
||||
}
|
||||
logf := func(format string, a ...interface{}) {
|
||||
_, _ = fmt.Fprintf(c.App.Writer, format, a...)
|
||||
}
|
||||
|
||||
// We need the controls from no-team.yml to apply them when applying the global app config.
|
||||
noTeamControls, noTeamPresent, err := extractControlsForNoTeam(flFilenames, appConfig)
|
||||
|
||||
Reference in New Issue
Block a user