def take_action(self, parsed_args): print bcolors.warning('Deleting %s' % settings_filepath) if raw_input('Are you sure? (y/N) ').upper() == 'Y': try: os.remove(settings_filepath) except OSError: pass print 'Done' else: print bcolors.fail('Cancel logout')
def procure_jira(self): print bcolors.header('\n\nJira\n') print 'To update your Jira tickets, I\'ll need three things:\n' print '1. Url (e.g. ' + bcolors.bold('http://jira.atlassian.net') + ')' print '2. Username ' + bcolors.warning('Note: Your Jira email will not work. You must provide your username.') print '3. Password\n' if self.jira_url: jira_url = raw_input('Jira Url (enter to use existing): ') else: jira_url = None while not jira_url: jira_url = raw_input('Jira Url; e.g. http://jira.atlassian.net: ') if jira_url: self.jira_url = jira_url if self.jira_username: jira_username = raw_input('Jira Username (enter to use existing): ') else: jira_username = None while not jira_username: jira_username = raw_input('Jira Username: '******'Jira Password (enter to use existing): ') else: jira_password = None while not jira_password: jira_password = raw_input('Jira Password: ') if jira_password: self.jira_password = jira_password
def ensure_open_ticket(ticket_id): """ Allows us to reopen a ticket once, and log against it a bunch of times. :param ticket_id: :return: """ # TODO: This gives race conditions if someone updates a ticket while we are logging time. ticket = jira.issue(ticket_id) status_id = ticket.fields.status.id if status_id == COMPLETE: reclose_transition = get_transition_id(status_id) jira.transition_issue(ticket, reopen_transition(ticket)) print bcolors.warning('Reopening ticket') try: yield finally: print bcolors.warning('Reclosing ticket') jira.transition_issue(ticket, reclose_transition(ticket)) else: # ticket is in a mutable state on jira, so we can just log away yield
def procure_jira(self): print bcolors.header('\n\nJira\n') print 'To update your Jira tickets, I\'ll need three things:\n' print '1. Url (e.g. ' + bcolors.bold('http://jira.atlassian.net') + ')' print '2. Username ' + bcolors.warning( 'Note: Your Jira email will not work. You must provide your username.' ) print '3. Password\n' if self.jira_url: jira_url = raw_input('Jira Url (enter to use existing): ') else: jira_url = None while not jira_url: jira_url = raw_input( 'Jira Url; e.g. http://jira.atlassian.net: ') if jira_url: self.jira_url = jira_url if self.jira_username: jira_username = raw_input( 'Jira Username (enter to use existing): ') else: jira_username = None while not jira_username: jira_username = raw_input('Jira Username: '******'Jira Password (enter to use existing): ') else: jira_password = None while not jira_password: jira_password = raw_input('Jira Password: ') if jira_password: self.jira_password = jira_password
def print_welcome_for_date(date): s = '\n************************************\n' s += '* Logging for day: %s *' % date.ctime().replace('00:00:00 ', '') s += '\n************************************\n' print bcolors.warning(s)
def print_welcome_for_date(date): s = "\n************************************\n" s += "* Logging for day: %s *" % date.ctime().replace("00:00:00 ", "") s += "\n************************************\n" print bcolors.warning(s)