andreafrancia / trash-cli

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

[Regression] trash-put no longer accept `--` to signal an end to option parsing #303

Closed toonn closed 1 year ago

toonn commented 1 year ago

Describe the bug trash-put used to respect passing -- as a sign to stop parsing arguments as options/flags. This is a convention among many CLI programs that have to deal with path arguments. Recent versions no longer respect this behavior. Ranger makes use of the -- argument and users noticed this problem.

trash-cli version Output of: trash-put --version

0.23.2.13.2 (as reported by the users)

Are you using the latest version of trash-cli? Yes

Have you tried if the bug is present in the latest version of trash-cli? Yes

Please, install the latest version of trash-cli and try again before submitting the bug :heavy_check_mark:

Have done that? Then continue with the bug report.

Operating system:

To Reproduce Copy and paste the commands (and their output) to execute in order to reproduce the behavior:

$ touch -foo $ trash-put -- -foo

Expected behavior I hope this was an accidental regression and not an intended backwards-compatibility breaking change. The output for trash-put --help still mentions the behavior so I have hope : )

andreafrancia commented 1 year ago

Right now I can't check, but if is confirmed it would be a unintended regression.

xiota commented 1 year ago

trash seems to treat -- as a file. Other arguments are moved to trash as expected.

$ trash --version
0.23.2.13.2

$ touch 1 2 3

$ ls
1  2  3

$ trash 3

$ ls
1  2

$ trash -- 2
trash: cannot trash non existent '--'

$ ls
1
xiota commented 1 year ago

Just built. 2b06075. Works as expected.

$ touch 1 2 3

$ ls
1  2  3

$ trash -- 2 3

$ ls
1
stelcodes commented 1 year ago

Running into this issue too. I'm probably going to stop using this implementation.

EDIT: I wasn't using recently released 23.9.23 version which fixes this problem

andreafrancia commented 1 year ago

@stelcodes on my computer it works

$ pip install trash-cli
Collecting trash-cli
  Using cached trash_cli-0.23.9.23-py3-none-any.whl
Requirement already satisfied: psutil in ./env/lib/python3.11/site-packages (from trash-cli) (5.9.5)
Requirement already satisfied: six in ./env/lib/python3.11/site-packages (from trash-cli) (1.16.0)
Installing collected packages: trash-cli
Successfully installed trash-cli-0.23.9.23
$ touch pippo
$ trash-put -- pippo
$ ls pippo
ls: cannot access 'pippo': No such file or directory

Please be sure of using the latest version of trash-cli. Run trash -v to verify your current version. Beware that on some system trash could be an alias, a function, or another command different from trash-put.

stelcodes commented 12 months ago

@andreafrancia Yes you are right, I was using the previous version. Thanks for the update!