From 69054a4008fe7a29b37e41e1559d3964857b4780 Mon Sep 17 00:00:00 2001 From: Ayooluwa Isaiah Date: Sat, 23 Nov 2024 07:17:40 +0100 Subject: [PATCH] retain leading and trailing spaces in string slice flags --- CHANGELOG.md | 5 +++++ app/app.go | 2 +- app/app_test/testdata/help_stdout.golden | 2 +- app/app_test/testdata/version_stdout.golden | 4 ++-- app/flag.go | 4 ++++ package.json | 2 +- 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1297b0..8c43cf8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.0.3 (2024-11-23) + +- Fix bug caused by space trimming in `--find`, `--replace`, `--exclude`, and + `--exclude-dir` + ## 2.0.2 (2024-11-22) - Fix bug with using commas in find or replace strings diff --git a/app/app.go b/app/app.go index 8fa8165..c910d8d 100644 --- a/app/app.go +++ b/app/app.go @@ -207,7 +207,7 @@ func CreateCLIApp(r io.Reader, w io.Writer) *cli.App { Usage: `f2 bulk renames files and directories, matching files against a specified pattern. It employs safety checks to prevent accidental overwrites and offers several options for fine-grained control over the renaming process.`, - Version: "v2.0.1", + Version: "v2.0.3", EnableBashCompletion: true, Flags: []cli.Flag{ flagCSV, diff --git a/app/app_test/testdata/help_stdout.golden b/app/app_test/testdata/help_stdout.golden index ec8bf3e..3313be2 100644 --- a/app/app_test/testdata/help_stdout.golden +++ b/app/app_test/testdata/help_stdout.golden @@ -1,4 +1,4 @@ -f2 v2.0.1 +f2 v2.0.3 Ayooluwa Isaiah f2 bulk renames files and directories, matching files against a specified diff --git a/app/app_test/testdata/version_stdout.golden b/app/app_test/testdata/version_stdout.golden index 1b9fd7d..04b6a44 100644 --- a/app/app_test/testdata/version_stdout.golden +++ b/app/app_test/testdata/version_stdout.golden @@ -1,2 +1,2 @@ -f2 version v2.0.1 -https://github.com/ayoisaiah/f2/releases/v2.0.1 \ No newline at end of file +f2 version v2.0.3 +https://github.com/ayoisaiah/f2/releases/v2.0.3 \ No newline at end of file diff --git a/app/flag.go b/app/flag.go index 05284ce..9a331d3 100644 --- a/app/flag.go +++ b/app/flag.go @@ -21,6 +21,7 @@ var ( When -s/--string-mode is used, this pattern is treated as a literal string.`, DefaultText: "", + KeepSpace: true, } flagReplace = &cli.StringSliceFlag{ @@ -31,6 +32,7 @@ var ( It supports capture variables, built-in variables, and exiftool variables. If omitted, it defaults to an empty string.`, DefaultText: "", + KeepSpace: true, } flagUndo = &cli.BoolFlag{ @@ -70,6 +72,7 @@ var ( --exclude-dir instead).`, DefaultText: "", + KeepSpace: true, } flagExcludeDir = &cli.StringSliceFlag{ @@ -78,6 +81,7 @@ var ( Prevents F2 from recursing into directories that match the provided regular expression pattern.`, DefaultText: "", + KeepSpace: true, } flagExec = &cli.BoolFlag{ diff --git a/package.json b/package.json index ddd5ec5..5e74ab1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ayoisaiah/f2", - "version": "2.0.2", + "version": "2.0.3", "description": "F2 is a command-line tool for batch renaming multiple files and directories quickly and safely", "main": "index.js", "repository": "https://github.com/ayoisaiah/f2",