feat: add replace subcommand with multi-pattern support

This commit is contained in:
Rogee
2025-10-29 17:46:54 +08:00
parent fa57af8a26
commit ceea09f7be
42 changed files with 1848 additions and 14 deletions

View File

@@ -29,5 +29,24 @@ func Execute() {
}
func init() {
// Register persistent flags shared by all subcommands (`list`, `replace`, etc.).
// These scope flags remain centralized so new commands automatically inherit
// traversal behavior without duplicating flag definitions.
listing.RegisterScopeFlags(rootCmd.PersistentFlags())
}
// NewRootCommand creates a fresh root command with all subcommands and flags registered.
func NewRootCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "renamer",
Short: "Safe, scriptable batch renaming utility",
Long: rootCmd.Long,
}
listing.RegisterScopeFlags(cmd.PersistentFlags())
cmd.AddCommand(newListCommand())
cmd.AddCommand(NewReplaceCommand())
cmd.AddCommand(newUndoCommand())
return cmd
}