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

Tor Bug Tracker & Wiki blackhole at torproject.org
Sat Oct 19 06:02:00 UTC 2013


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

Comment (by dcf):

 argparse can generate `--help` output automatically, right? For me that's
 the killer feature. (If we can coax it into writing part of our man pages
 too, that's double killer.)

 I don't get the purpose of the `_parse_module_opts` trick in the
 description. What concretely happens in `# do something`? Couldn't you
 just call a function that just calls `add_argument` for each common
 option?

 FYI, the class `options` in most of the programs isn't meant to stand for
 "command-line options"; it is really just a container for a lot of global
 variables (most of which happen to be manipulatable through command-line
 options). On first appraisal, I would like to continue using the command-
 line parser as a data source for filling in the `options` table, but I
 would not like to couple internal options so tightly to the command-line
 interface as to replace the global options table with a global `Namespace`
 object. On the other hand, maybe it doesn't matter much either way.

 argparse is used by obfsproxy so we already figured out its bundle
 packaging issues.

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/9975#comment:1>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list