Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

select 'ruplacement`by piping them though fzf or other selector #44

Closed
sucrecacao opened this issue Aug 5, 2020 · 4 comments
Closed

Comments

@sucrecacao
Copy link

Hi !
First, thank for this amazing tool ! I use it almost on a daily basis :)
Sometime ruplacer over-deliver replacement candidate, and I wold like to select only a subset of them.
Would it be possible to pipe the candidate into a selector like fzf to achieve this purpose ?

If not, could you give me some pointer on how to achieve it ?

@dmerejkowsky
Copy link
Collaborator

Not sure I understand what you want. fzf can only select one candidate from a list of lines, no?

Can you give me more details?

@sucrecacao
Copy link
Author

No fzf can select multiple choices with the -m option.

The idea it to select a subset of the proposed patches. If you are a vim user, the idea is a bit like as using the c (confirm) option when doing a search an replace : s/old/new/c. But implemented differently ( with a selector like fzf )

Let's say I want to replace my old variable with new. But I also have word like behold oldish and Freeholder that also match the old regex. I dont want to bother finding a complex regex that will only match my old variable, I just want to select on the fly the right patches.

@sucrecacao
Copy link
Author

Maybe an interesting feature that could solve this is the following two options:
--writes-patches-to-folder that put all the patches into a folder, one patch per file. The use would be
ruplacer old new . --writes-patches-to-folder /tmp/mypatches

Now it is possible manually ( or with a fzf script ) to remove the unwanted replacement in the /tmp/mypatches folder.

And then a second option --apply-from-folder that could be using instead of the regex for the --go option:
ruplacer --go --apply-from-foler /tmp/mypatches
Actually I don't think I would have to ruplacer for this part. It could be done simply with the patch command. So I guess only the first feature would be interesting heh

@dmerejkowsky
Copy link
Collaborator

You may want to try sad - it's a bit different from ruplacer, but you may prefer it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants