def review(config, tags, no_tags, match, listname, attachments, has_due, by_due): '''show a smart, command-line based menu for each card selected. This menu will prompt you to add tags to untagged cards, to attach the title of cards which have a link in the title, and gives you all the other functionality combined. ''' connection, board = BoardTool.start(config) if by_due: cards = BoardTool.filter_cards(board, has_due_date=True) cards = sorted(cards, key=lambda c: c.due) else: cards = BoardTool.filter_cards( board, tags=tags, no_tags=no_tags, title_regex=match, list_regex=listname, has_attachments=attachments, has_due_date=has_due, ) list_lookup = BoardTool.list_lookup(board) label_lookup = BoardTool.label_lookup(board) display = Display(config.color) if config.banner: display.banner() for card in cards: CardTool.smart_menu(card, display.show_card, list_lookup, label_lookup, color=config.color) click.echo('All done, have a great day!')
def add_card(config, title, message, edit, listname): '''Add a new card. If no title is provided, $EDITOR will be opened so you can write one.''' connection, board = BoardTool.start(config) if listname is None: inbox = BoardTool.get_inbox_list(connection, config) else: pattern = re.compile(listname, flags=re.I) target_lists = filter(lambda x: pattern.search(x.name), board.get_lists('open')) try: inbox = next(target_lists) except StopIteration: click.secho('No list names matched by {}'.format(listname), fg='red') raise GTDException(1) if not title: title = click.edit(require_save=True, text='<Title here>') if title is None: # No changes were made in $EDITOR click.secho('No title entered for the new card!', fg='red') raise GTDException(1) else: title = title.strip() returned = inbox.add_card(name=title, desc=message) if edit: display = Display(config.color) list_lookup = BoardTool.list_lookup(board) label_lookup = BoardTool.label_lookup(board) CardTool.smart_menu(returned, display.show_card, list_lookup, label_lookup, color=config.color) else: click.secho('Successfully added card {0}!'.format(returned), fg='green')
def add_card(config, title, message, edit): '''Add a new card. If no title is provided, $EDITOR will be opened so you can write one.''' connection, board = BoardTool.start(config) inbox = BoardTool.get_inbox_list(connection, config) if not title: title = click.edit(require_save=True, text='<Title here>') if title is None: # No changes were made in $EDITOR click.secho('No title entered for the new card!', fg='red') raise GTDException(1) else: title = title.strip() returned = inbox.add_card(name=title, desc=message) if edit: display = Display(config.color) list_lookup = BoardTool.list_lookup(board) label_lookup = BoardTool.label_lookup(board) CardTool.smart_menu(returned, display.show_card, list_lookup, label_lookup, Colors.yellow) else: click.secho('Successfully added card {0}!'.format(returned), fg='green')
def add_card(config, title, message, edit): '''Add a new card. If no title is provided, $EDITOR will be opened so you can write one.''' connection, board = BoardTool.start(config) inbox = BoardTool.get_inbox_list(connection, config) if not title: title = click.edit(require_save=True, text='<Title here>') if title is None: # No changes were made in $EDITOR click.secho('No title entered for the new card!', fg='red') raise GTDException(1) else: title = title.strip() returned = inbox.add_card(name=title, desc=message) if edit: display = Display(config.color) list_lookup = BoardTool.list_lookup(board) label_lookup = BoardTool.label_lookup(board) CardTool.smart_menu(returned, display.show_card, list_lookup, label_lookup, Colors.yellow) else: click.secho('Successfully added card {0}!'.format(returned), fg='green')
def review(config, tags, no_tags, match, listname, attachments, has_due): '''show a smart, command-line based menu for each card selected. This menu will prompt you to add tags to untagged cards, to attach the title of cards which have a link in the title, and gives you all the other functionality combined. ''' connection, board = BoardTool.start(config) cards = BoardTool.filter_cards( board, tags=tags, no_tags=no_tags, title_regex=match, list_regex=listname, has_attachments=attachments, has_due_date=has_due ) list_lookup = BoardTool.list_lookup(board) label_lookup = BoardTool.label_lookup(board) display = Display(config.color) if config.banner: display.banner() for card in cards: CardTool.smart_menu(card, display.show_card, list_lookup, label_lookup, Colors.yellow) click.echo('All done, have a great day!')