[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: dcf
Type: enhancement | Status: new
Priority: minor | Milestone:
Component: Flashproxy | Version:
Resolution: | Keywords:
Actual Points: | Parent ID:
Points: |
-----------------------------+-----------------
Comment (by infinity0):
In argparse, there are two stages - you configure your parser
(`add_argument`), then you do the parsing (`parse_args` then process the
`Namespace` object that comes out of it).
Some options really belong to utility modules - for example `--unsafe-
logging` is only used by the logging code and safe_str. We can move this
code into the common library, and also put the configuration there
(`add_module_opts`), as well as processing of the `Namespace` object
(`_parse_module_opts`).
It works essentially as you want - the internal options class (or whatever
other representation we choose) could remain, and we'd just process the
`Namespace` object to populate it. So for the `# do something` example,
this might be `flashproxy_util_options.unsafe_logging =
parsed_opts.unsafe_logging`.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/9975#comment:2>
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