def main_build_index(args=[], prog_name=sys.argv[<NUM_LIT:0>]):
<EOL>ui = getUI_build_index(prog_name, args)<EOL>if ui.optionIsSet("<STR_LIT:test>"):<EOL><INDENT>unittest.main(argv=[sys.argv[<NUM_LIT:0>]])<EOL>sys.exit()<EOL><DEDENT>if ui.optionIsSet("<STR_LIT>"):<EOL><INDENT>ui.usage()<EOL>sys.exit()<EOL><DEDENT>verbose = (ui.optionIsSet("<STR_LIT>") is True) or DEFAULT_VERBOSITY<EOL>in_fhs = [open(x) for x in ui.getAllArguments()]<EOL>if in_fhs == []:<EOL><INDENT>if sys.stdin.isatty():<EOL><INDENT>sys.stderr.write("<STR_LIT>")<EOL><DEDENT>in_fhs = [sys.stdin]<EOL><DEDENT>out_fhs = [sys.stdout]<EOL>if ui.optionIsSet("<STR_LIT>"):<EOL><INDENT>out_fhs = [open(x, "<STR_LIT:w>") for x in ui.getValue("<STR_LIT>").split()]<EOL><DEDENT>if len(in_fhs) != len(out_fhs):<EOL><INDENT>sys.stderr.write("<STR_LIT>")<EOL>sys.exit(<NUM_LIT:0>)<EOL><DEDENT>op_val = ui.getValue("<STR_LIT:type>") if ui.optionIsSet("<STR_LIT:type>") else None<EOL>indexer = __get_indexer(ui.getAllArguments(), op_val)<EOL>for in_fh, out_fh in zip(in_fhs, out_fhs):<EOL><INDENT>indexer(in_fh, out_fh, verbose)<EOL><DEDENT>
main entry point for the index script.

:param args:      the arguments for this script, as a list of string. Should
                  already have had the script name stripped. That is, if
                  there are no args provided, this should be an empty list.
:param prog_name: the name of the script; taken from command line args by
                  default, but you can change it if you want.