-
-
Notifications
You must be signed in to change notification settings - Fork 845
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
add --dry-run option to cli and implement it #946
Conversation
I wasn't aware of the minimum rust version. The API used was stabilized in
|
What benefit does this have over just prepending an echo in front of the command? |
nothing that I can think of actually, I just didn't think of that. Made the change and ensured it runs and clears tests on 1.54 so should be good now. sorry for that! |
I think the question is more like, why is |
ah, like that. Gotcha. Well honestly, not all that much. When I implemented this feature I didn't realise that prepending an echo would still capture most arguments as being associated with the correct command nor that it would still expand the placeholders. I had tried the echo method before but in my cases I found that very cumbersome due to the nested " and ' I thought were necessary to associate the commands correctly and actually lost some files due to doing that incorrectly while using |
FWIW, |
@savente93 Thank you very much for this contribution. I really appreciate the effort and I definitely think we should do something about the problem you mentioned (commands being executed that you didn't intend to). I usually also use There is also another problem here: an official A way to potentially solve this (although I'm not convinced this is a good idea) would be to add a flag similar to the |
Thanks for the kind words, that really means a lot to me :) I think all the points made are valid. Shall I close this PR and open an issue to discuss this further, or would you like to continue the conversation here? |
|
I've implemented a
--dry-run
since it is a need that I've found myself having when usingfd
. I'm aware that I should have created an issue first for discussion, which I only realised after implementing the feature. However, because it is somewhat related to #943 as well as being a relatively minor/simple change I decided to open a PR anyway. If there are things that will need discussion I'm happy to close this and open another PR once all the discussions are resolved.Otherwise, there is not that much to say about this change. All it does is take the
dry_run
option from the CLI and pass it down to the commands being executed so they can be printed instead of executed. For this I've mostly just repurposed existing code and tests with slight adjustments for the use case. Hoping this will be an easy merge :)