[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #9975 [Flashproxy]: use argparse rather than getopt



#9975: use argparse rather than getopt
-----------------------------+--------------------------
     Reporter:  infinity0    |      Owner:  infinity0
         Type:  enhancement  |     Status:  needs_review
     Priority:  minor        |  Milestone:
    Component:  Flashproxy   |    Version:
   Resolution:               |   Keywords:
Actual Points:               |  Parent ID:
       Points:               |
-----------------------------+--------------------------

Comment (by infinity0):

 Replying to [comment:9 atagar]:
 > > This issue is particularly baffling.
 >
 > True, positional arguments is one thing it definitely does not handle
 well. Stem and arm don't need that, but if you do then you might need to
 fall back on checking the argv for those (ick).

 If we really need this, it can be done with a separate optional vs
 positional parser. Call `parse_known_args` on the optional parser, then
 pass `unknown_args` to the positional parser. Not sure why this isn't
 mentioned as a workaround on that ticket. (Some additional fudging would
 be needed to make the help text work correctly though.)

 Another thing which is a bit easier on argparse is taking additional
 options from a module, so that different programs can share the same
 options. This reduces quite a lot of code duplication. It is probably
 possible on getopt but the methods I can think of are all very messy.

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/9975#comment:10>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs