~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzr-man.py

add a clean target

Show diffs side-by-side

added added

removed removed

Lines of Context:
91
91
 
92
92
    def parse_line(self, line):
93
93
        m = self.usage_exp.match(line)
94
 
        if line == '':
95
 
                return
96
94
        if m:
97
95
            if self.state == 0:
98
96
                if self.usage:
99
97
                    self.command_usage.append((self.command,self.usage,self.descr))
100
98
                    self.all_commands.append(self.command)
101
 
                self.usage = " ".join(line.split(" ")[1:])
 
99
                self.usage = line
102
100
                self.command = m.groups()[0]
103
101
            else:
104
 
                raise RuntimeError, "matching usage line in state %d" % state
 
102
                raise Error, "matching usage line in state %d" % state
105
103
            self.state = 1
106
104
            return
107
105
        m = self.descr_exp.match(line)
109
107
            if self.state == 1:
110
108
                self.descr = m.groups()[0]
111
109
            else:
112
 
                raise RuntimeError, "matching descr line in state %d" % state
 
110
                raise Error, "matching descr line in state %d" % state
113
111
            self.state = 0
114
112
            return
115
 
        raise RuntimeError, "Cannot parse this line ('%s')." % line
 
113
        raise Error, "Cannot parse this line"
116
114
 
117
115
    def end_parse(self):
118
116
        if self.state == 0:
120
118
                self.command_usage.append((self.command,self.usage,self.descr))
121
119
                self.all_commands.append(self.command)
122
120
        else:
123
 
            raise RuntimeError, "ending parse in state %d" % state
 
121
            raise Error, "ending parse in state %d" % state
124
122
 
125
123
    def write_to_manpage(self, outfile):
126
124
        bzrcmd = self.params["bzrcmd"]