chmln / sd

Intuitive find & replace CLI (sed alternative)
MIT License
5.72k stars 136 forks source link

Feature request: REPL mode #261

Open dev-ardi opened 10 months ago

dev-ardi commented 10 months ago

This is very easy to implement and allows for easier debugging.

I can implement this as soon as 1.0 has been branched.

CosmicHorrorDev commented 10 months ago

Conveniently enough I was just giving this some thought yesterday. Related:

My current idea for UI is similar to what git checkout -p does where it displays a diff showing the change on a single chunk (for us we would probably show a prompt on every single replacement), and then you have an input where the user can select applying that change to all found values, applying that change to a single value, skipping a single value, and quitting

Is that similar to what you had in mind?

dev-ardi commented 10 months ago

Honestly I was thinking about what sed does already: sed "s/foo/bar/g" launches you into some sort of repl mode. You input a line and you get the result, and since we have the colored output already the user experience should be nice enough. We would need the line by line mode (I opened a PR for it already)

CosmicHorrorDev commented 10 months ago

Ah yes, that's just sed reading from stdin. We should be able to support the same once your line by line mode PR is merged