Skip to content

Commit 1ad4ee7

Browse files
committedAug 13, 2018
Added --updatable flag in core list command
1 parent 1388c00 commit 1ad4ee7

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed
 

‎commands/core/list.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,21 @@ import (
2727

2828
func initListCommand() *cobra.Command {
2929
listCommand := &cobra.Command{
30-
Use: "list",
31-
Short: "Shows the list of installed cores.",
32-
Long: "Shows the list of installed cores.\n" +
33-
"With -v tag (up to 2 times) can provide more verbose output.",
34-
Example: " " + commands.AppName + "core list -v # for a medium verbosity level.",
30+
Use: "list",
31+
Short: "Shows the list of installed platforms.",
32+
Long: "Shows the list of installed platforms.",
33+
Example: " " + commands.AppName + "core list",
3534
Args: cobra.NoArgs,
3635
Run: runListCommand,
3736
}
37+
listCommand.Flags().BoolVar(&listFlags.updatableOnly, "updatable", false, "List updatable platforms.")
3838
return listCommand
3939
}
4040

41+
var listFlags struct {
42+
updatableOnly bool
43+
}
44+
4145
func runListCommand(cmd *cobra.Command, args []string) {
4246
logrus.Info("Executing `arduino core list`")
4347

@@ -47,6 +51,9 @@ func runListCommand(cmd *cobra.Command, args []string) {
4751
for _, targetPackage := range pm.GetPackages().Packages {
4852
for _, platform := range targetPackage.Platforms {
4953
if platformRelease := platform.GetInstalled(); platformRelease != nil {
54+
if listFlags.updatableOnly && platform.GetLatestRelease() == platformRelease {
55+
continue
56+
}
5057
res = append(res, platformRelease)
5158
}
5259
}

0 commit comments

Comments
 (0)
Please sign in to comment.