~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to generate_docs.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-10-31 04:39:04 UTC
  • mfrom: (3565.6.16 switch_nick)
  • Revision ID: pqm@pqm.ubuntu.com-20081031043904-52fnbfrloojemvcc
(mbp) branch nickname documentation

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
#
15
15
# You should have received a copy of the GNU General Public License
16
16
# along with this program; if not, write to the Free Software
17
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
18
 
19
19
"""%(prog)s - generate information from built-in bzr help
20
20
 
32
32
 
33
33
Run "%(prog)s --help" for the option reference.
34
34
"""
35
 
import os
 
35
 
36
36
import sys
37
37
from optparse import OptionParser
38
38
 
39
 
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
40
 
 
41
 
import bzrlib
42
 
from bzrlib import (
43
 
    commands,
44
 
    # Don't remove the following import, it triggers a format registration that
45
 
    # avoid http://pad.lv/956860
46
 
    branch,
47
 
    doc_generate,
48
 
    )
49
 
 
 
39
import tools.doc_generate
50
40
 
51
41
def main(argv):
52
42
    parser = OptionParser(usage="""%prog [options] OUTPUT_FORMAT
79
69
        parser.print_help()
80
70
        sys.exit(1)
81
71
 
82
 
    with bzrlib.initialize():
83
 
        commands.install_bzr_command_hooks()
84
 
        infogen_type = args[1]
85
 
        infogen_mod = doc_generate.get_module(infogen_type)
86
 
        if options.filename:
87
 
            outfilename = options.filename
88
 
        else:
89
 
            outfilename = infogen_mod.get_filename(options)
90
 
        if outfilename == "-":
91
 
            outfile = sys.stdout
92
 
        else:
93
 
            outfile = open(outfilename,"w")
94
 
        if options.show_filename and (outfilename != "-"):
95
 
            sys.stdout.write(outfilename)
96
 
            sys.stdout.write('\n')
97
 
        infogen_mod.infogen(options, outfile)
98
 
 
 
72
    infogen_type = args[1]
 
73
    infogen_mod = tools.doc_generate.get_module(infogen_type)
 
74
 
 
75
    if options.filename:
 
76
        outfilename = options.filename
 
77
    else:
 
78
        outfilename = infogen_mod.get_filename(options)
 
79
 
 
80
    if outfilename == "-":
 
81
        outfile = sys.stdout
 
82
    else:
 
83
        outfile = open(outfilename,"w")
 
84
 
 
85
    if options.show_filename and (outfilename != "-"):
 
86
        sys.stdout.write(outfilename)
 
87
        sys.stdout.write('\n')
 
88
    
 
89
    infogen_mod.infogen(options, outfile)
99
90
 
100
91
def print_extended_help(option, opt, value, parser):
101
92
    """ Program help examples