Skip to content

Commit

Permalink
v2.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
shenwei356 committed Jan 12, 2024
1 parent 57c5535 commit 7bb6ede
Show file tree
Hide file tree
Showing 9 changed files with 255 additions and 204 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ t.*
binaries
brename_*
*.brename_detail.txt

example/
441 changes: 245 additions & 196 deletions README.md

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions brename.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2013-2022 Wei Shen <[email protected]>
// Copyright © 2013-2024 Wei Shen <[email protected]>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -176,7 +176,7 @@ func getOptions(cmd *cobra.Command) *Options {
log.Warningf("something wrong when trying to check whether %s is a existed file", infilter)
}
if existed {
log.Warningf("Seems you are using wildcard for -f/--include-filters? Make sure using regular expression: %s", infilter)
log.Warning("Seems you are using wildcard for -f/--include-filters? Make sure using regular expression: %s", infilter)
}
}

Expand Down Expand Up @@ -461,7 +461,7 @@ func init() {
log = logging.MustGetLogger(app)

RootCmd.Flags().BoolP("quiet", "q", false, "be quiet, do not show any information and warning")
RootCmd.Flags().IntP("verbose", "v", 2, "verbose level (0 for all, 1 for warning, error and renamed files, 2 for only error and renamed files) (default 2)")
RootCmd.Flags().IntP("verbose", "v", 2, "verbose level (0 for all, 1 for warning, error and renamed files, 2 for only error and renamed files)")
RootCmd.Flags().BoolP("version", "V", false, "print version information and check for update")
RootCmd.Flags().BoolP("dry-run", "d", false, "print rename operations but do not run")

Expand Down Expand Up @@ -659,7 +659,7 @@ var RootCmd = &cobra.Command{
Use: app,
Short: "a cross-platform command-line tool for safely batch renaming files/directories via regular expression",
Long: fmt.Sprintf(`
brename -- a practical cross-platform command-line tool for safely batch renaming files/directories via regular expression
brename: a practical cross-platform command-line tool for safely batch renaming files/directories via regular expression
Version: %s
Expand Down Expand Up @@ -897,7 +897,7 @@ Special replacement symbols:
log.Info()
}

if !opt.Quiet || opt.DryRun {
if (!opt.Quiet || opt.DryRun) && !opt.ListPath {
log.Info(bold("Searching for paths to rename..."))
log.Info()
}
Expand All @@ -908,7 +908,7 @@ Special replacement symbols:
checkError(err)
}
}
if !opt.Quiet && !opt.DryRun {
if !opt.Quiet && !opt.DryRun && !opt.ListPath {
fmt.Fprintf(os.Stderr, "\r %-78s\n", green("Done searching."))
}
close(opCH)
Expand Down Expand Up @@ -1231,7 +1231,7 @@ func walk(opt *Options, opCh chan<- operation, path string, depth int) error {
if opt.MaxDepth > 0 && depth > opt.MaxDepth {
return nil
}
if !opt.Quiet && !opt.DryRun {
if !opt.Quiet && !opt.DryRun && !opt.ListPath {
_path := path
n := len(_path)
if n > 78 {
Expand All @@ -1255,7 +1255,7 @@ func walk(opt *Options, opCh chan<- operation, path string, depth int) error {
// it's a directory
files, err := os.ReadDir(path)
if err != nil {
if !opt.Quiet && !opt.DryRun {
if !opt.Quiet && !opt.DryRun && !opt.ListPath {
fmt.Fprintf(os.Stderr, "\n")
}
if !opt.IgnoreErr {
Expand Down
Binary file added screenshot/check-error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot/dry-run.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed screenshot/linux.png
Binary file not shown.
Binary file added screenshot/success.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot/undo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed screenshot/windows.png
Binary file not shown.

0 comments on commit 7bb6ede

Please sign in to comment.