feat: do nothing without force flag

This commit is contained in:
Jan Bader 2025-04-25 11:55:03 +02:00
parent 48b1493696
commit 40265a41fc

View File

@ -15,6 +15,7 @@ var execCmd string
func main() { func main() {
flag.BoolVar(&dryrun, "n", false, "Show what would have been done.") flag.BoolVar(&dryrun, "n", false, "Show what would have been done.")
force := flag.Bool("force", false, "Actually rename files.")
flag.StringVar(&execCmd, "exec", "", "Run command on matching file.") flag.StringVar(&execCmd, "exec", "", "Run command on matching file.")
path := flag.String("path", ".", "Handle files in path.") path := flag.String("path", ".", "Handle files in path.")
flag.Parse() flag.Parse()
@ -24,8 +25,8 @@ func main() {
return return
} }
if !dryrun { if !dryrun && !*force {
panic("please dry run first") panic("please dry run first or use the force flag to actually rename files")
} }
switch flag.Arg(0) { switch flag.Arg(0) {