~ubuntu-branches/ubuntu/precise/bughelper/precise

« back to all changes in this revision

Viewing changes to bugHelper/commandLine.py

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-08-23 16:16:51 UTC
  • Revision ID: james.westby@ubuntu.com-20070823161651-38cz13hfuw32aglc
Tags: 0.2
* Include Markus' API changes to make bughelper work with the new
  python-launchpad-bugs API. 
* Also includes the Bughelper Server, which will generate automatic reports
  for Bughelper Queries based on the cluefile data we have.
* Thanks a lot Markus and thanks also Google for making the Summer of Code
  possible.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
    import launchpadBugs.utils as utils
10
10
 
11
11
class commandLine:
12
 
    def __init__(self):
 
12
    def __init__(self, prog=None):
13
13
        parser = OptionParser(version=utils.find_version_number())
14
 
        if parser.get_prog_name() == "bughelper":
 
14
        if parser.get_prog_name() == "bughelper" or prog == "bughelper":
15
15
            parser.set_defaults(attachments=False, sourcepackage=None, 
16
 
                                url=None, minbug=None, verbose=0,
 
16
                                url="", minbug=None, verbose=0,
17
17
                                case_sensitive=False,file=None)
18
18
            parser.set_usage(usage="""%prog --version
19
19
       %prog -p <source package> 
48
48
    [--reporter <reporter,...>]         filter on initial reporter
49
49
    [--nd (<|>)<int>]                   filter on given number of duplicates
50
50
    [--footer (s|t|st)]                 show (s)tatistical or date/(t)ime information
51
 
                                        in the footer, (st) for both""")
 
51
                                        in the footer, (st) for both
 
52
    [--cookie <filename>]               valid cookie-file for authentication
 
53
    [--debug]                           print debug information to stderr""")
52
54
            parser.add_option("-p", "--package", type="string", 
53
55
                                    dest="sourcepackage", 
54
56
                                    metavar="package name", 
110
112
                              default="", help="print to file")
111
113
            parser.add_option("--footer", type="string", dest="footer",
112
114
                              default="", help="print information in the footer")
 
115
            parser.add_option("--cookie", type="string", dest="cookie",
 
116
                              default="", help="valid cookie-file for authentication")
 
117
            parser.add_option("--debug", action="store_true", dest="debug",
 
118
                              help="print debug infos to stderr")
113
119
 
114
120
        if parser.get_prog_name() == "bugnumbers":
115
 
            parser.set_defaults(package=None, url=None, minbug=None,file=None)
 
121
            parser.set_defaults(package=None, url="", minbug=None,file=None)
116
122
            parser.set_usage(usage="""%prog --version
117
123
       %prog -p <package>
118
124
       %prog -l <Launchpad-URL>
132
138
    [--sort <option>]           sort output
133
139
    [--nd (<|>)<int>]           filter on given number of duplicates
134
140
    [--tag <tag>]               filter on given tag
 
141
    [--lc <reporter|LP-user>]   filter on last comment
135
142
    [--reporter <reporter,...>] filter on initial reporter
136
 
    [--lc <reporter|LP-user>]   filter on last comment""")
 
143
    [--cookie <filename>]       valid cookie-file for authentication""")
 
144
 
137
145
            parser.add_option("-p", "--package", type="string", 
138
146
                                    dest="sourcepackage", 
139
147
                                    metavar="package name", help="Package")
178
186
            parser.add_option("--format", type="string", dest="format", 
179
187
                                    default="plain", 
180
188
                                    help="format output type (plain|wiki|html)")
 
189
            parser.add_option("--cookie", type="string", dest="cookie",
 
190
                              default="", help="valid cookie-file for authentication")
181
191
 
182
192
 
183
193
        if parser.get_prog_name() == "bugxml":
249
259
                                    help="show last comment")
250
260
        # options with arguments
251
261
        self.parser = parser
252
 
        (self.options, self.args) = parser.parse_args()
 
262
        if not prog:
 
263
            (self.options, self.args) = parser.parse_args()
253
264