#2470: deluge-console's parsing of commands is surprising
---------------------+--------------------
Reporter: eevee | Owner:
Type: bug | Status: new
Priority: minor | Milestone: Future
Component: Console | Version: 1.3.6
Keywords: |
---------------------+--------------------
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
[https://docs.python.org/2/library/optparse.html#optparse.OptionParser.disable_interspersed_args
`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.
--
Ticket URL: <http://dev.deluge-torrent.org/ticket/2470>
Deluge <http://deluge-torrent.org/>
Deluge project
--
You received this message because you are subscribed to the Google Groups
"Deluge Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/deluge-dev.
For more options, visit https://groups.google.com/d/optout.