Add extension normalization command

This commit is contained in:
Rogee
2025-10-30 10:31:53 +08:00
parent f66c59fd57
commit 6a353b5086
35 changed files with 2306 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"os"
"path/filepath"
"strings"
"github.com/spf13/cobra"
@@ -25,7 +26,18 @@ func newUndoCommand() *cobra.Command {
return err
}
fmt.Fprintf(cmd.OutOrStdout(), "Undo applied: %d operations reversed\n", len(entry.Operations))
out := cmd.OutOrStdout()
fmt.Fprintf(out, "Undo applied: %d operations reversed\n", len(entry.Operations))
if entry.Command == "extension" && entry.Metadata != nil {
if target, ok := entry.Metadata["targetExtension"].(string); ok && target != "" {
fmt.Fprintf(out, "Restored extensions to %s\n", target)
}
if sources, ok := entry.Metadata["sourceExtensions"].([]string); ok && len(sources) > 0 {
fmt.Fprintf(out, "Previous sources: %s\n", strings.Join(sources, ", "))
}
}
return nil
},
}