Skip to content

Commit 22f0ad2

Browse files
committed
Revert "Make --recursive flag a string input"
This reverts commit c260881.
1 parent 6cb7626 commit 22f0ad2

File tree

4 files changed

+3
-10
lines changed

4 files changed

+3
-10
lines changed

internal/cli/cli.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func Root() *cobra.Command {
3535
rootCommand.PersistentFlags().String("format", "text", "The output format can be {text|json}.")
3636
rootCommand.PersistentFlags().String("library-manager", "", "Configure the rules for libraries in the Arduino Library Manager index. Can be {submit|update|false}.\nsubmit: Also run additional rules required to pass before a library is accepted for inclusion in the index.\nupdate: Also run additional rules required to pass before new releases of a library already in the index are accepted.\nfalse: Don't run any Library Manager-specific rules.")
3737
rootCommand.PersistentFlags().String("project-type", "all", "Only check projects of the specified type and their subprojects. Can be {sketch|library|all}.")
38-
rootCommand.PersistentFlags().String("recursive", "true", "Search path recursively for Arduino projects to check. Can be {true|false}.")
38+
rootCommand.PersistentFlags().Bool("recursive", true, "Search path recursively for Arduino projects to check. Can be {true|false}.")
3939
rootCommand.PersistentFlags().String("report-file", "", "Save a report on the rules to this file.")
4040
rootCommand.PersistentFlags().BoolP("verbose", "v", false, "Show more information while running rules.")
4141
rootCommand.PersistentFlags().Bool("version", false, "Print version and timestamp of the build.")

internal/configuration/configuration.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,7 @@ func Initialize(flags *pflag.FlagSet, projectPaths []string) error {
8181
return fmt.Errorf("--project-type flag value %s not valid", superprojectTypeFilterString)
8282
}
8383

84-
recursiveString, _ := flags.GetString("recursive")
85-
recursive, err = strconv.ParseBool(recursiveString)
86-
if err != nil {
87-
return fmt.Errorf("--recursive flag value %s not valid", recursiveString)
88-
}
84+
recursive, _ = flags.GetBool("recursive")
8985

9086
reportFilePathString, _ := flags.GetString("report-file")
9187
reportFilePath = paths.New(reportFilePathString)

internal/configuration/configuration_test.go

-3
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,6 @@ func TestInitializeProjectType(t *testing.T) {
159159
func TestInitializeRecursive(t *testing.T) {
160160
flags := test.ConfigurationFlags()
161161

162-
flags.Set("recursive", "foo")
163-
assert.Error(t, Initialize(flags, projectPaths))
164-
165162
flags.Set("recursive", "true")
166163
assert.Nil(t, Initialize(flags, projectPaths))
167164
assert.True(t, Recursive())

internal/util/test/test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func ConfigurationFlags() *pflag.FlagSet {
2727
flags.String("log-format", "text", "")
2828
flags.String("log-level", "panic", "")
2929
flags.String("project-type", "all", "")
30-
flags.String("recursive", "true", "")
30+
flags.Bool("recursive", true, "")
3131
flags.String("report-file", "", "")
3232
flags.Bool("verbose", false, "")
3333
flags.Bool("version", false, "")

0 commit comments

Comments
 (0)