def get_script(self): commands.install_bzr_command_hooks() dc = DataCollector() data = dc.collect() cg = BashCodeGen(data) res = cg.function() return res
def main(argv): parser = OptionParser(usage="""%prog [options] OUTPUT_FORMAT Available OUTPUT_FORMAT: man man page rstx man page in ReStructuredText format bash_completion bash completion script""") parser.add_option("-s", "--show-filename", action="store_true", dest="show_filename", default=False, help="print default filename on stdout") parser.add_option("-o", "--output", dest="filename", metavar="FILE", help="write output to FILE") parser.add_option("-b", "--brz-name", dest="brz_name", default="brz", metavar="EXEC_NAME", help="name of brz executable") parser.add_option("-e", "--examples", action="callback", callback=print_extended_help, help="Examples of ways to call generate_doc") (options, args) = parser.parse_args(argv) if len(args) != 2: parser.print_help() sys.exit(1) with breezy.initialize(), ExitStack() as es: # Import breezy.bzr for format registration, see <http://pad.lv/956860> from breezy import bzr as _ commands.install_bzr_command_hooks() infogen_type = args[1] infogen_mod = doc_generate.get_module(infogen_type) if options.filename: outfilename = options.filename else: outfilename = infogen_mod.get_filename(options) if outfilename == "-": outfile = sys.stdout else: outfile = es.enter_context(open(outfilename, "w")) if options.show_filename and (outfilename != "-"): sys.stdout.write(outfilename) sys.stdout.write('\n') infogen_mod.infogen(options, outfile)
def setUp(self): super(TestDataCollector, self).setUp() commands.install_bzr_command_hooks()