Exemplo n.º 1
0
def cmd_edit(tl, args):
    """allows editing a given todo item
    
    :description: This action will open an editor. 
        If you're done editing, save the file and close the editor or cancel
        editing by pressing ``Ctrl+C``.
    
    * item: the index number of the item to edit
    """
    with ColorRenderer() as cr:
        if not args.item:
            open_editor(conf.todo_file)
            quit(0)
        item = tl.get_item_by_index(args.item)
        if not item:
            print("Could not find item '{item_id}'".format(item_id=args.item))
            return

        print(" ", cr.render(item))
        try:
            output = get_editor_input(item.text)
            # remove new lines
            edited_item = TodoItem(
                output.replace("\r\n", " ").replace("\n", " ").strip())
            tl.replace_item(item, edited_item)
            suppress_if_quiet(u"  {item}".format(item=cr.render(edited_item)),
                              args)
            edited_item.check()
        except KeyboardInterrupt:
            # editing has been aborted
            pass
Exemplo n.º 2
0
def cmd_edit(tl, args):
    """allows editing a given todo item
    
    :description: This action will open an editor. 
        If you're done editing, save the file and close the editor or cancel
        editing by pressing ``Ctrl+C``.
    
    * item: the index number of the item to edit
    """
    with ColorRenderer() as cr:
        if not args.item:
            open_editor(conf.todo_file)
            quit(0)
        item = tl.get_item_by_index(args.item)
        if not item:
            print("Could not find item '{item_id}'".format(item_id = args.item))
            return
        
        print(" ", cr.render(item))
        try:
            output = get_editor_input(item.text)
            # remove new lines
            edited_item = TodoItem(output.replace("\r\n", " ").replace("\n", " ").strip())
            tl.replace_item(item, edited_item)
            suppress_if_quiet(u"  {item}".format(item = cr.render(edited_item)), args)
            edited_item.check()
        except KeyboardInterrupt:
            # editing has been aborted
            pass
Exemplo n.º 3
0
def cmd_edit(tl, args):
    """allows editing a given todo item
    """
    with ColorRenderer() as cr:
        if not args.item:
            open_editor(conf.todo_file)
            quit(0)
        item = tl.get_item_by_index(args.item)
        if not item:
            print("Could not find item '{item_id}'".format(item_id = args.item))
            return
        
        print(" ", cr.render(item))
        try:
            output = get_editor_input(item.text)
            # remove new lines
            edited_item = TodoItem(output.replace("\r\n", " ").replace("\n", " ").strip())
            tl.replace_item(item, edited_item)
            suppress_if_quiet(u"  {item}".format(item = cr.render(edited_item)), args)
            edited_item.check()
        except KeyboardInterrupt:
            # editing has been aborted
            pass
Exemplo n.º 4
0
def cmd_config(tl, args):  #@UnusedVariable
    """open todo.next configuration in editor
    
    Required fields of :param:`args`:
    """
    open_editor(conf.config_file)
Exemplo n.º 5
0
def cmd_config(tl, args): #@UnusedVariable
    """open todo.next configuration in editor
    """
    open_editor(conf.config_file)
Exemplo n.º 6
0
def cmd_config(tl, args): #@UnusedVariable
    """open todo.next configuration in editor
    
    Required fields of :param:`args`:
    """
    open_editor(conf.config_file)