andreafrancia / trash-cli

Command line interface to the freedesktop.org trashcan.
GNU General Public License v2.0
3.63k stars 177 forks source link

Specify a global trash directory? #163

Closed chongchonghe closed 3 years ago

chongchonghe commented 4 years ago

I work on a supercomputer cluster where I share a disk /lustre with many other users. My working folder is located at /lustre/MyID. Now, the trash-cli thinks the trash directory is /lustre/.Trash-$UID, which doesn't exist and I have no privilege to mkdir.

Is there a way to setup a global trash directory (in my case I would set to /lustre/MyID/.Trash) that works for all the trash-* commands? I know I can use --trash-dir=TRASHDIR option, but I don't see a way to specify trash-dir to trash-list.

mikemajara commented 4 years ago

How can you use --trash-dir=TRASHDIR?

chongchonghe commented 4 years ago

How can you use --trash-dir=TRASHDIR?

trash-put --trash-dir=TRASHDIR stuff

mikemajara commented 4 years ago

I might have missed something, but here is the output I get

$> ~ touch stuff
$> ~ trash-put --trash-dir=./Trash stuff
Usage: trash-put [OPTION]... FILE...

trash-put: error: no such option: --trash-dir
chongchonghe commented 4 years ago

--trash-dir=TRASHDIR option works on my linux machine on a cluster, but it doesn't work on my MacBook. Both running with the verison 0.17.1.14. I have no idea why.

Here's what trash -h returns on my linux machine:  

$ trash -h
Usage: trash [OPTION]... FILE...

Put files in trash

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -d, --directory       ignored (for GNU rm compatibility)
  -f, --force           ignored (for GNU rm compatibility)
  -i, --interactive     ignored (for GNU rm compatibility)
  -r, -R, --recursive   ignored (for GNU rm compatibility)
  --trash-dir=TRASHDIR  use TRASHDIR as trash folder
  -v, --verbose         explain what is being done

On Thu, Apr 30 2020 at 09:11, MikeMajara notifications@github.com wrote:

How can you use --trash-dir=TRASHDIR?

— You are receiving this because you authored the thread. Reply to this email directly, [1]view it on GitHub, or [2]unsubscribe.*

References:

[1] https://github.com/andreafrancia/trash-cli/issues/163#issuecomment-621825482 [2] https://github.com/notifications/unsubscribe-auth/AF2UTTO2LGMAXN3TRDYRHVTRPF2HZANCNFSM4MLAXW4A

mikemajara commented 4 years ago

I'm not even getting the option in help. Having the same version.

output for my macOS machine.

mypc ~ trash-put -h
Usage: trash-put [OPTION]... FILE...

Put files in trash

Options:
  --version            show program's version number and exit
  -h, --help           show this help message and exit
  -d, --directory      ignored (for GNU rm compatibility)
  -f, --force          ignored (for GNU rm compatibility)
  -i, --interactive    ignored (for GNU rm compatibility)
  -r, -R, --recursive  ignored (for GNU rm compatibility)
  -v, --verbose        explain what is being done

To remove a file whose name starts with a '-', for example '-foo',
use one of these commands:

    trash -- -foo

    trash ./-foo

Report bugs to https://github.com/andreafrancia/trash-cli/issues
mypc ~ trash-put --version
trash-put 0.17.1.14

When I get some free time I might be able to look into the code.

andreafrancia commented 3 years ago

With commit f11df22ffac87102289fa7dbac955a484133bd1c trash-list learnt a new option: --trash-dir.