Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
Lagoja authored and guerinoni committed Feb 1, 2025
1 parent 9672a6d commit ae7730e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 48 deletions.
31 changes: 29 additions & 2 deletions internal/boxcli/list.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 Jetify Inc. and contributors. All rights reserved.
// Copyright 2025 Jetify Inc. and contributors. All rights reserved.
// Use of this source code is governed by the license in the LICENSE file.

package boxcli
Expand All @@ -15,7 +15,8 @@ import (
)

type listCmdFlags struct {
config configFlags
config configFlags
outdated bool
}

func listCmd() *cobra.Command {
Expand All @@ -34,6 +35,10 @@ func listCmd() *cobra.Command {
return errors.WithStack(err)
}

if flags.outdated {
return outdatedPackage(cmd, box)
}

for _, pkg := range box.AllPackagesIncludingRemovedTriggerPackages() {
resolvedVersion, err := pkg.ResolvedVersion()
if err != nil {
Expand All @@ -57,6 +62,28 @@ func listCmd() *cobra.Command {
return nil
},
}

cmd.Flags().BoolVar(&flags.outdated, "outdated", false, "List outdated packages")
flags.config.register(cmd)
return cmd
}

// outdatedPackage prints a list of outdated packages.
func outdatedPackage(cmd *cobra.Command, box *devbox.Devbox) error {
results, err := box.Outdated(cmd.Context())
if err != nil {
return errors.WithStack(err)
}

if len(results) == 0 {
cmd.Println("Your packages are up to date!")
return nil
}

cmd.Println("The following packages can be updated:")
for pkg, version := range results {
cmd.Printf(" * %-30s %s -> %s\n", pkg, version.Current, version.Latest)
}

return nil
}
45 changes: 0 additions & 45 deletions internal/boxcli/outdated.go

This file was deleted.

1 change: 0 additions & 1 deletion internal/boxcli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ func RootCmd() *cobra.Command {
command.AddCommand(infoCmd())
command.AddCommand(initCmd())
command.AddCommand(installCmd())
command.AddCommand(outdatedCmd())
command.AddCommand(integrateCmd())
command.AddCommand(listCmd())
command.AddCommand(logCmd())
Expand Down

0 comments on commit ae7730e

Please sign in to comment.