def main(argv): parser = get_parser() # The parser arguments (cfg.args) are accessible everywhere after this call. cfg.args = parser.parse_args() # This initiates the global yml configuration instance so it will be # accessible everywhere after this call. cfg.initiate_config() jira, username = jiralogin.get_jira_instance(cfg.args.t) updates = list(enumerate_updates(jira)) pendings = list(enumerate_pending(jira)) assignees = sorted(set([u['assignee'] for u in updates]) | set([p['assignee'] for p in pendings])) # Move "Unassigned" issues to the end assignees.sort(key='Unassigned'.__eq__) template = Template(output) print(template.render(assignees=assignees, updates=updates, pendings=pendings)) if cfg.args.html: f = open(cfg.args.html, 'w') template = Template(output_html) f.write(template.render(assignees=assignees, updates=updates, pendings=pendings)) f.close()
def main(argv): parser = get_parser() # The parser arguments (cfg.args) are accessible everywhere after this call. cfg.args = parser.parse_args() initialize_logger(cfg.args) # This initiates the global yml configuration instance so it will be # accessible everywhere after this call. cfg.initiate_config() if not cfg.args.file and not cfg.args.q: log.error("No file provided and not in query mode\n") parser.print_help() sys.exit(os.EX_USAGE) jira, username = jiralogin.get_jira_instance(cfg.args.t) if cfg.args.x or cfg.args.e: if not cfg.args.q: log.error( "Arguments '-x' and '-e' can only be used together with '-q'") sys.exit(os.EX_USAGE) if cfg.args.p and not cfg.args.q: log.error("Arguments '-p' can only be used together with '-q'") sys.exit(os.EX_USAGE) if cfg.args.q: (filename, issues) = get_jira_issues(jira, username) if cfg.args.p: print_status_file(filename) sys.exit(os.EX_OK) elif cfg.args.file is not None: filename = cfg.args.file else: log.error( "Trying to run script with unsupported configuration. Try using --help." ) sys.exit(os.EX_USAGE) if get_editor(): open_editor(filename) try: issues # issues is not defined, we haven't made any query yet. except NameError: parse_status_file(jira, filename, None) else: parse_status_file(jira, filename, issues)