trash-cli icon indicating copy to clipboard operation
trash-cli copied to clipboard

feature request: trash-restore accept argument instead of prompt and support specific destination to store

Open snowman opened this issue 5 years ago • 4 comments

When running trash-restore without argument, which by default show restorable files in list, and prompt user to select one to restore

$ trash-restore
0 2020-09-28 09:29:57 /tmp/foo.sh
1 2020-09-28 09:49:22 /tmp/bar.sh
2 2020-09-28 09:49:31 /tmp/custom.el
What file to restore [0..2]:

I want to run without interaction, like when run trash-restore 0, it should output something like:

restore /tmp/foo.sh SUCCESS.
# but if output already exists, exit or prompt to confirm overwrite or force overwrite
$ touch /tmp/foo.sh
$ trash-restore 0
Refusing to overwrite existing file "foo.sh"
ignore me
or maybe specify DEST directory to restore the file,
like when specify both number and DEST,
it should move the whole path (create its parent directory if NOT exist), like:
```
$ trash-restore 0 /tmp
restore /tmp/foo.sh to /tmp/tmp/foo.sh SUCCESS
```

snowman avatar Sep 29 '20 08:09 snowman

It'd also be nice if trash-restore could accept lines from trash-ls. That would allow doing a simple pipe such as: trash-ls | fzf | trash-restore, which would be a very nice interface to use.

jeyj0 avatar Nov 25 '20 17:11 jeyj0

If someone is here from a google search on using trash-restore with fzf, I came up with a (hacky) solution:

alias trash-restore='echo 0 | trash-restore $(trash-list | grep $(pwd) --color=never | sed "s/^[^/]*//" | fzf) > /dev/null'

(Note: this will only list files in the current directory, if you want to list files everywhere remove the grep part)

ItsProfessional avatar Feb 20 '24 08:02 ItsProfessional

The number may change between different invocations. I think trash-restore should accept a path argument instead of a number.

andreafrancia avatar Mar 28 '24 13:03 andreafrancia

I agree.

ItsProfessional avatar Mar 28 '24 17:03 ItsProfessional