Created
March 1, 2011 05:21
-
-
Save tbielawa/848657 to your computer and use it in GitHub Desktop.
I want option_lists for GroupParser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 | |
33 class Runner: | |
34 options_table = [ | |
35 Option("-a", "--auth-endpoint", dest="auth_endpoint", action="store", | |
36 help="endpoint to support the remote user framework"), | |
37 Option("-c", "--config", action="store", | |
38 help="config file path"), | |
39 Option("-e", "--endpoint", action="store", | |
40 help="URL to nushus xmlrpc endpoint"), | |
41 Option("-f", "--force", action="store_true", | |
42 help="Force download of package queue. This implies -q"), | |
43 Option("-k", "--kerberos", action="store_true", | |
44 help="Use Kerberos to Authenticate"), | |
45 Option("-K", "--kerb-auth-endpoint", dest="kerb_auth_endpoint", | |
46 action="store", help="endpoint to support kerb auth"), | |
47 Option("-p", "--plugin", action="store", | |
48 help="invoke a plugin"), | |
49 Option("-q", "--queue", action="store_true", | |
50 help="Use package queue"), | |
51 Option("-r", "--repo", dest="slugs", action="append", | |
52 help="Nushus repo slugs, multiple can be passed"), | |
53 Option("-s", "--slug", dest="search", action="append", | |
54 help="Depricated, use repo. Will become search in 0.13.0"), | |
55 Option("-v", "--verbose", action="count", | |
56 help="increase verbosity"), | |
57 ] | |
58 option_parser_class = OptionParser | |
59 filerepo = False | |
60 | |
61 def __init__(self): | |
62 self.options = None | |
63 self.args = None | |
64 self.cfg = None | |
65 self._server = None | |
66 self.max_request_size = None | |
67 | |
68 def init(self): | |
69 parser = self.option_parser_class(option_list=self.options_table) | |
70 self.options, self.args = parser.parse_args() | |
71 return 1 | |
72 | |
73 def nushus_config(self): | |
74 username = None | |
75 password = None | |
76 endpoint = None | |
77 | |
78 self.cfg = cfg = ConfigParser.ConfigParser() | |
But I want to group these like this: | |
options_table_basics = [ | |
Option("-e", "--endpoint", action="store", | |
help="URL to nushus xmlrpc endpoint"), | |
Option("-r", "--repo", dest="slugs", action="append", | |
help="Nushus repo slugs, multiple can be passed"), | |
] | |
self.cfg = ConfigParser.ConfigParser() | |
group = OptionGroup(self.cfg, "Basic options here", option_list=options_table_basics) | |
self.cfg.add_option_group(group) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment