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

Support integration with xplr by allowing to print paths selected for deletion #87

Closed
sayanarijit opened this issue Apr 15, 2021 · 8 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@sayanarijit
Copy link

Hi, Nice tool. I have added an integration hack with xplr.
However, for better integration experience, is there a way to print the selected paths? This would allow migration of the dua-cli selected paths to xplr selection.

@Byron Byron changed the title Better integration Improve integration with xplr by allowing to print selected paths Apr 15, 2021
@Byron
Copy link
Owner

Byron commented Apr 15, 2021

Nice indeed, thanks!

Do you mean it would be nice to print paths selected for deletion upon quitting dua?

@Byron Byron added the question Further information is requested label Apr 15, 2021
@sayanarijit
Copy link
Author

Yes. Instead of deleting, it can return the paths via stdout, and then other tools can decide what to do with them.

@Byron Byron changed the title Improve integration with xplr by allowing to print selected paths Support integration with xplr by allowing to print paths selected for deletion Apr 16, 2021
@Byron Byron added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed and removed question Further information is requested labels Apr 16, 2021
@sayanarijit
Copy link
Author

Maybe a command line option, something like -p PATH (for pipe) can be implemented. -p /tmp/list.txt will pipe the paths to /tmp/list.txt, while -p - will print them to stdout.

@Byron Byron closed this as completed in 017cbd7 Jun 8, 2021
@Byron
Copy link
Owner

Byron commented Jun 8, 2021

This should be resolved with dua v2.13, where dua i unconditionally prints remaining marked items. This should be fine as the default workflow usually is to mark and delete, leaving no items in the pane. If somebody leaves them it's either because the wanted to, or because they quit by mistake. In the latter case it's probably desirable to have the paths 'memorized' in the terminal in case they want to try again.

Only for the users who quit intentionally (maybe because they changed their mind) will the new behaviour be surprising as they now see selected paths that they never care about. Lastly, in case deletion fails due to permission errors for instance, paths will be printed as well as they would remain in the pane. For these users it might also be interesting to see them as they can try again by hand with sudo.

This is the reasoning for printing remaining paths by default, currently without a way to turn that off.

@sayanarijit
Copy link
Author

Thanks a lot. Really well thought out and creative solution 👍

@sayanarijit
Copy link
Author

Hi, I tried integrating, but there's some issue.

➜  ~ dua i | xargs -l 'echo SelectPath: "{}"'
Error: Interactive mode requires a connected terminal
xargs: echo SelectPath: "{}": No such file or directory

➜  ~ paths=$(dua i)
Error: Interactive mode requires a connected terminal

➜  ~ dua i > x
Error: Interactive mode requires a connected terminal

@Byron
Copy link
Owner

Byron commented Jun 9, 2021

A great point, sorry for the oversight.

In version 2.13.1 it's implemented so that the TUI wants to write to stderr, allowing the redirections of stdout to catch the selected files.

I hope this works now :).

@sayanarijit
Copy link
Author

Works now. Thanks.

➜  ~ x=$(dua i)
➜  ~ echo $x
.android
.cargo
.pyenv
Documents
Unity
snap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants