Opened 3 years ago

Closed 12 months ago

#2470 closed feature-request (Fixed)

deluge-console's parsing of commands is surprising

Reported by: eevee Owned by:
Priority: minor Milestone: 2.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 (4)

comment:1 Changed 3 years ago by Cas

  • Component changed from Console to Console (new ncurses)
  • Milestone changed from Future to 1.4.0
  • Type changed from bug to feature-request

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

comment:2 Changed 3 years ago by Cas

  • Component changed from Console (new ncurses) to 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 Changed 18 months ago by Cas

  • Milestone changed from 2.0.x to 2.0

comment:4 Changed 12 months ago by Cas

  • Resolution set to Fixed
  • Status changed from new to closed

Fixed in develop: [20bae1bf90]

Note: See TracTickets for help on using tickets.