From 58f07603cd23059a25c25095baf5908be9ba160f Mon Sep 17 00:00:00 2001 From: Virgil Date: Thu, 2 Apr 2026 05:16:51 +0000 Subject: [PATCH] fix: allow pkg update without package args --- cmd/core/pkgcmd/cmd_manage.go | 5 +---- cmd/core/pkgcmd/cmd_manage_test.go | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/cmd/core/pkgcmd/cmd_manage.go b/cmd/core/pkgcmd/cmd_manage.go index c4831a0..bc4b0ee 100644 --- a/cmd/core/pkgcmd/cmd_manage.go +++ b/cmd/core/pkgcmd/cmd_manage.go @@ -165,9 +165,6 @@ func addPkgUpdateCommand(parent *cobra.Command) { Short: i18n.T("cmd.pkg.update.short"), Long: i18n.T("cmd.pkg.update.long"), RunE: func(cmd *cobra.Command, args []string) error { - if !updateAll && len(args) == 0 { - return errors.New(i18n.T("cmd.pkg.error.specify_package")) - } return runPkgUpdate(args, updateAll) }, } @@ -197,7 +194,7 @@ func runPkgUpdate(packages []string, all bool) error { } var toUpdate []string - if all { + if all || len(packages) == 0 { for _, r := range reg.List() { toUpdate = append(toUpdate, r.Name) } diff --git a/cmd/core/pkgcmd/cmd_manage_test.go b/cmd/core/pkgcmd/cmd_manage_test.go index b3093d5..d6cda11 100644 --- a/cmd/core/pkgcmd/cmd_manage_test.go +++ b/cmd/core/pkgcmd/cmd_manage_test.go @@ -291,3 +291,17 @@ func TestRunPkgSearch_RespectsLimitWithCachedResults(t *testing.T) { assert.Contains(t, out, "core-alpha") assert.NotContains(t, out, "core-beta") } + +func TestRunPkgUpdate_NoArgs_UpdatesAll(t *testing.T) { + tmp := setupOutdatedRegistry(t) + withWorkingDir(t, tmp) + + out := capturePkgOutput(t, func() { + err := runPkgUpdate(nil, false) + require.NoError(t, err) + }) + + assert.Contains(t, out, "updating") + assert.Contains(t, out, "core-fresh") + assert.Contains(t, out, "core-stale") +} -- 2.45.3