Skip to content

Commit ae7730e

Browse files
Lagojaguerinoni
authored andcommitted
fix typo
1 parent 9672a6d commit ae7730e

File tree

3 files changed

+29
-48
lines changed

3 files changed

+29
-48
lines changed

internal/boxcli/list.go

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Jetify Inc. and contributors. All rights reserved.
1+
// Copyright 2025 Jetify Inc. and contributors. All rights reserved.
22
// Use of this source code is governed by the license in the LICENSE file.
33

44
package boxcli
@@ -15,7 +15,8 @@ import (
1515
)
1616

1717
type listCmdFlags struct {
18-
config configFlags
18+
config configFlags
19+
outdated bool
1920
}
2021

2122
func listCmd() *cobra.Command {
@@ -34,6 +35,10 @@ func listCmd() *cobra.Command {
3435
return errors.WithStack(err)
3536
}
3637

38+
if flags.outdated {
39+
return outdatedPackage(cmd, box)
40+
}
41+
3742
for _, pkg := range box.AllPackagesIncludingRemovedTriggerPackages() {
3843
resolvedVersion, err := pkg.ResolvedVersion()
3944
if err != nil {
@@ -57,6 +62,28 @@ func listCmd() *cobra.Command {
5762
return nil
5863
},
5964
}
65+
66+
cmd.Flags().BoolVar(&flags.outdated, "outdated", false, "List outdated packages")
6067
flags.config.register(cmd)
6168
return cmd
6269
}
70+
71+
// outdatedPackage prints a list of outdated packages.
72+
func outdatedPackage(cmd *cobra.Command, box *devbox.Devbox) error {
73+
results, err := box.Outdated(cmd.Context())
74+
if err != nil {
75+
return errors.WithStack(err)
76+
}
77+
78+
if len(results) == 0 {
79+
cmd.Println("Your packages are up to date!")
80+
return nil
81+
}
82+
83+
cmd.Println("The following packages can be updated:")
84+
for pkg, version := range results {
85+
cmd.Printf(" * %-30s %s -> %s\n", pkg, version.Current, version.Latest)
86+
}
87+
88+
return nil
89+
}

internal/boxcli/outdated.go

Lines changed: 0 additions & 45 deletions
This file was deleted.

internal/boxcli/root.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ func RootCmd() *cobra.Command {
6666
command.AddCommand(infoCmd())
6767
command.AddCommand(initCmd())
6868
command.AddCommand(installCmd())
69-
command.AddCommand(outdatedCmd())
7069
command.AddCommand(integrateCmd())
7170
command.AddCommand(listCmd())
7271
command.AddCommand(logCmd())

0 commit comments

Comments
 (0)