Merge branch 'trunk' into create-autolinks

This commit is contained in:
Michael Hoffman 2025-01-10 09:46:59 -05:00 committed by GitHub
commit c09b5fa551
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 3 deletions

View file

@ -469,9 +469,18 @@ func (m *Manager) Upgrade(name string, force bool) error {
}
func (m *Manager) upgradeExtensions(exts []*Extension, force bool) error {
var longestExtName = 0
for _, ext := range exts {
l := len(ext.Name())
if len(ext.Name()) > longestExtName {
longestExtName = l
}
}
format := fmt.Sprintf("[%%%ds]: ", longestExtName)
var failed bool
for _, f := range exts {
fmt.Fprintf(m.io.Out, "[%s]: ", f.Name())
fmt.Fprintf(m.io.Out, format, f.Name())
currentVersion := displayExtensionVersion(f, f.CurrentVersion())
err := m.upgradeExtension(f, force)
if err != nil {

View file

@ -256,7 +256,7 @@ func TestManager_UpgradeExtensions(t *testing.T) {
`
[hello]: upgraded from old vers to new vers
[local]: local extensions can not be upgraded
[two]: upgraded from old vers to new vers
[ two]: upgraded from old vers to new vers
`,
), stdout.String())
assert.Equal(t, "", stderr.String())
@ -293,7 +293,7 @@ func TestManager_UpgradeExtensions_DryRun(t *testing.T) {
`
[hello]: would have upgraded from 0 to 1
[local]: local extensions can not be upgraded
[two]: would have upgraded from 2 to 3
[ two]: would have upgraded from 2 to 3
`,
), stdout.String())
assert.Equal(t, "", stderr.String())