dalance / amber

A code search / replace tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Suggestion: When ambr is used with --regex, show the replacement that will be used

Boscop opened this issue · comments

Suggestion: When ambr is used with --regex, show the replacement that will be used.
So that the user can check if the given substitution expr was correct, before replacing everything..

Thank you for your suggestion. Do you mean like below?

$ ./target/debug/ambr --column version version2
./src/ambr.rs: 23:#[structopt(raw(long_version = "option_env!(\"LONG_VERSION\").unwrap_or(env!(\"CARGO_PKG_VERSION\"))"))]
               -> #[structopt(raw(long_version2 = "option_env!(\"LONG_VERSION\").unwrap_or(env!(\"CARGO_PKG_VERSION\"))"))]
Replace keyword? [Y]es/[n]o/[a]ll/[q]uit

Yes, it's also a good idea to align the "before" and "after" lines for easier visual comparison.


Btw, after skipping the first few matches with [n]o, [a]ll means "all following", not including the skipped ones, right?

I merged the feature to show replacement.

Btw, after skipping the first few matches with [n]o, [a]ll means "all following", not including the skipped ones, right?

Yes. That's right.

@dalance How can I enable the show_replacement feature? :)

@Boscop the feature is enabled, but not released.
I released as v0.5.3 now.