Skip to content

Commit 0d0a2f8

Browse files
committed
Moved 'core list' flags into command creation
1 parent 609ee20 commit 0d0a2f8

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

cli/core/list.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,25 @@ import (
2929
"github.com/spf13/cobra"
3030
)
3131

32-
var (
33-
updatableOnly bool
34-
all bool
35-
)
36-
3732
func initListCommand() *cobra.Command {
33+
var updatableOnly bool
34+
var all bool
3835
listCommand := &cobra.Command{
3936
Use: "list",
4037
Short: tr("Shows the list of installed platforms."),
4138
Long: tr("Shows the list of installed platforms."),
4239
Example: " " + os.Args[0] + " core list",
4340
Args: cobra.NoArgs,
44-
Run: runListCommand,
41+
Run: func(cmd *cobra.Command, args []string) {
42+
runListCommand(args, all, updatableOnly)
43+
},
4544
}
4645
listCommand.Flags().BoolVar(&updatableOnly, "updatable", false, tr("List updatable platforms."))
4746
listCommand.Flags().BoolVar(&all, "all", false, tr("If set return all installable and installed cores, including manually installed."))
4847
return listCommand
4948
}
5049

51-
func runListCommand(cmd *cobra.Command, args []string) {
50+
func runListCommand(args []string, all bool, updatableOnly bool) {
5251
inst := instance.CreateAndInit()
5352
logrus.Info("Executing `arduino-cli core list`")
5453

0 commit comments

Comments
 (0)