def run():
config_option_help = "<STR_LIT>"<EOL>parser = OptionParser()<EOL>parser.add_option("<STR_LIT>", "<STR_LIT>", action="<STR_LIT:store>",<EOL>type="<STR_LIT:string>", dest="<STR_LIT>", help="<STR_LIT>")<EOL>parser.add_option("<STR_LIT:-c>", "<STR_LIT>", action="<STR_LIT:store>",<EOL>type="<STR_LIT:string>", dest="<STR_LIT>", help=config_option_help)<EOL>parser.add_option("<STR_LIT>", "<STR_LIT>", action="<STR_LIT:store>",<EOL>type="<STR_LIT:string>", dest="<STR_LIT>", help="<STR_LIT>")<EOL>parser.add_option("<STR_LIT>", "<STR_LIT>", action="<STR_LIT:store>",<EOL>type="<STR_LIT:string>", dest="<STR_LIT>", help="<STR_LIT>")<EOL>parser.add_option("<STR_LIT>", "<STR_LIT>", action="<STR_LIT:store>",<EOL>type="<STR_LIT:string>", dest="<STR_LIT>", help="<STR_LIT>")<EOL>options, args = parser.parse_args()<EOL>if options.config:<EOL><INDENT>if options.config == "<STR_LIT>":<EOL><INDENT>config_option_list = '<STR_LIT>'<EOL>config_sections = config.sections()<EOL>for section in config_sections:<EOL><INDENT>config_option_list = config_option_list+section+"<STR_LIT:\n>"<EOL>section_items = config.items(section)<EOL>for item in section_items:<EOL><INDENT>config_option_list = config_option_list +"<STR_LIT:U+0020>"+item[<NUM_LIT:0>]+"<STR_LIT:U+0020>"+item[<NUM_LIT:1>]+"<STR_LIT:\n>"<EOL><DEDENT><DEDENT>print(config_option_list)<EOL>quit()<EOL><DEDENT><DEDENT>def add_notes(note_name, existing_tags):<EOL><INDENT>call([editor, environ["<STR_LIT>"] + "<STR_LIT>"+note_name+"<STR_LIT>"])<EOL>definedtags = input("<STR_LIT>").split("<STR_LIT:U+0020>")<EOL>definedtags.append(note_name)<EOL>print(definedtags)<EOL>print(existing_tags)<EOL>definedtags = list(set(definedtags)-set(existing_tags))<EOL>print(definedtags)<EOL>if len(definedtags) > <NUM_LIT:0>:<EOL><INDENT>modify_tags_xml(note_name, definedtags, files,<EOL>rootfiles, tags, roottags, tree, TAGS_XML_DIR)<EOL><DEDENT><DEDENT>def get_tags_from_file(note_name):<EOL><INDENT>fil = get_file_from_files(note_name)<EOL>filetags = fil.iter('<STR_LIT>')<EOL>filetaglist = []<EOL>for tag in filetags:<EOL><INDENT>filetaglist.append(tag.text)<EOL><DEDENT>return filetaglist<EOL><DEDENT>if options.addfile:<EOL><INDENT>existing_tags = []<EOL>if isFile(options.addfile, files):<EOL><INDENT>existing_tags = get_tags_from_file(options.addfile)<EOL>input("<STR_LIT>"+"<STR_LIT:U+0020>".join(existing_tags) +<EOL>"<STR_LIT>")<EOL><DEDENT>add_notes(options.addfile, existing_tags)<EOL>quit()<EOL><DEDENT>if options.editfile:<EOL><INDENT>if isFile(options.editfile, files):<EOL><INDENT>add_notes(note_name, [])<EOL><DEDENT>else:<EOL><INDENT>input(<EOL>"<STR_LIT>")<EOL>add_notes(note_name)<EOL><DEDENT><DEDENT>if options.remove:<EOL><INDENT>pass<EOL><DEDENT>if len(args) != <NUM_LIT:1>:<EOL><INDENT>print("<STR_LIT>")<EOL>quit()<EOL><DEDENT>_key_File = "<STR_LIT>"<EOL>_key_Results = "<STR_LIT>"<EOL>table = {_key_Results: []}<EOL>for tag in tags:<EOL><INDENT>if tag.attrib["<STR_LIT:value>"] == args[<NUM_LIT:0>]:<EOL><INDENT>fileelements = tag.iter("<STR_LIT:file>")<EOL>for fileelement in fileelements:<EOL><INDENT>f = open(<EOL>environ["<STR_LIT>"] + "<STR_LIT>" + fileelement.text+"<STR_LIT>", "<STR_LIT:r>")<EOL>table[_key_Results].append(<EOL>f.read()+"<STR_LIT>"+fileelement.text+"<STR_LIT>")<EOL>f.close()<EOL><DEDENT><DEDENT><DEDENT>print(tabulate(table, headers=[], tablefmt="<STR_LIT>"))<EOL>
Main method where all logic is defined