Skip to content

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

Closed

Description

@sayanarijit

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.

Activity

  1. changed the title [-]Better integration[/-] [+]Improve integration with `xplr` by allowing to print selected paths[/+] on Apr 15, 2021
  2. Byron commented on Apr 15, 2021

    @Byron
    Owner

    Nice indeed, thanks!

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

  3. added
    question
    on Apr 15, 2021
  4. sayanarijit commented on Apr 15, 2021

    @sayanarijit
    Author

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

  5. 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[/+] on Apr 16, 2021
  6. added
    enhancement
    good first issue
    help wanted
    and removed
    question
    on Apr 16, 2021
  7. sayanarijit commented on Jun 7, 2021

    @sayanarijit
    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.

  8. Byron commented on Jun 8, 2021

    @Byron
    Owner

    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.

  9. sayanarijit commented on Jun 8, 2021

    @sayanarijit
    Author

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

  10. sayanarijit commented on Jun 9, 2021

    @sayanarijit
    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
    
  11. Byron commented on Jun 9, 2021

    @Byron
    Owner

    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 :).

  12. sayanarijit commented on Jun 9, 2021

    @sayanarijit
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issuehelp wanted

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions