Opened 10 years ago

Closed 8 years ago

Last modified 6 years ago

#2470 closed feature-request (Fixed)

deluge-console's parsing of commands is surprising

Reported by: eevee Owned by:
Priority: minor Milestone: 2.0.0
Component: Console UI Version: 1.3.6
Keywords: Cc:

Description

Since this works:

deluge-console info some-torrent-id

I also expected this to work, in the tradition of sudo and ssh and the like:

deluge-console info -s Paused

But instead I get:

deluge-console: error: no such option: -s

Googling around found that the command is "supposed" to be quoted, and in fact the source code mentions this in the help text for the CommandOptionGroup, though it doesn't seem to render for me:

  Console Commands:
    info quit pause halt plugin del cache resume add exit connect debug rm
    config recheck help

Anyway, I believe this can be trivially fixed by using `parser.disable_interspersed_args()`, which forces optparse to stop parsing at the first positional argument it sees and treat all the rest as positional arguments.

That means deluge-console info --version will no longer just show the version, but I think that's probably okay. On the other hand, deluge-console info --help will actually work correctly.

(It's a shame that the remaining arguments are ultimately joined with spaces and re-parsed; seems like it would be nice to avoid reparsing when there are multiple args, so you can have filenames containing semicolons and whatever else you want. But that's a little more invasive.)

Deluge 1.3.6 on Arch x64, fwiw.

Change History (5)

comment:1 by Calum, 10 years ago

Component: ConsoleConsole (new ncurses)
Milestone: Future1.4.0
Type: bugfeature-request

Thanks, this is something I was aware of but hadn't got around to testing, it could go into 1.4.

comment:2 by Calum, 10 years ago

Component: Console (new ncurses)Console

Added to 1.3-stable [a4fb8e769bbd] and develop [3e610ec5ba3]

I'll leave this open for now to cover the idea of avoiding reparsing but probably something for the future rather than 1.4.

comment:3 by Calum, 9 years ago

Milestone: 2.0.x2.0

comment:4 by Calum, 8 years ago

Resolution: Fixed
Status: newclosed

Fixed in develop: [20bae1bf90]

comment:5 by Calum, 6 years ago

Milestone: 2.02.0.0

Milestone renamed

Note: See TracTickets for help on using tickets.