Skip to content

Commit

Permalink
flag -N/--nature-sort is applied to files to be renamed, rather than …
Browse files Browse the repository at this point in the history
…just for listing files. #36
  • Loading branch information
shenwei356 committed Apr 14, 2024
1 parent 33a65bb commit 44744e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
- v2.14.1
- flag `-N/--nature-sort` is applied to files to be renamed, rather than just for listing files. [#36](https://github.com/shenwei356/brename/issues/36)
- v2.14.0
- **setting default value of `-v/--verbose` as 2, which make the output more concise**. [#31](https://github.com/shenwei356/brename/issues/31)
- output format changed.
Expand Down
8 changes: 4 additions & 4 deletions brename.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import (

var log *logging.Logger

var VERSION = "2.14.0"
var VERSION = "2.14.1"
var app = "brename"
var LastOpDetailFile = ".brename_detail.txt"

Expand Down Expand Up @@ -482,7 +482,7 @@ func init() {
RootCmd.Flags().BoolP("list", "l", false, `only list paths that match pattern`)
RootCmd.Flags().StringP("list-sep", "s", "\n", `separator for list of found paths`)
RootCmd.Flags().BoolP("list-abs", "a", false, `list absolute path, using along with -l/--list`)
RootCmd.Flags().BoolP("nature-sort", "N", false, `list paths in nature sort, using along with -l/--list`)
RootCmd.Flags().BoolP("nature-sort", "N", false, `sort paths in nature order for renaming or listing`)

RootCmd.Flags().StringP("kv-file", "k", "",
`tab-delimited key-value file for replacing key with value when using "{kv}" in -r (--replacement)`)
Expand Down Expand Up @@ -1295,7 +1295,7 @@ func walk(opt *Options, opCh chan<- operation, path string, depth int) error {
}

if !opt.OnlyDir {
if opt.ListPath && opt.NatureSort {
if opt.NatureSort {
natsort.Sort(_files)
}
for _, filename := range _files {
Expand All @@ -1310,7 +1310,7 @@ func walk(opt *Options, opCh chan<- operation, path string, depth int) error {
}

// sub directory
if opt.ListPath && opt.NatureSort {
if opt.NatureSort {
natsort.Sort(_dirs)
}
for _, filename := range _dirs {
Expand Down

0 comments on commit 44744e2

Please sign in to comment.