Example #1
0
    def modify(self, modstring):
        # If no modstring was passed as argument, ask the user interactively
        if not modstring:
            with util.current_line_highlighted():
                modstring = util.get_input("Enter modifications: ")

        # We might have two same tasks in the range, make sure we do not pass the
        # same uuid twice
        unique_tasks = set(vimwikitask.task['uuid'] for vimwikitask in self.tasks)
        uuids = list(unique_tasks)

        # Generate the arguments from the modstring
        args = util.tw_modstring_to_args(modstring)

        # Modify all tasks at once
        output = util.tw_execute_safely(self.tw, uuids + ['mod'] + args)

        # Update the touched tasks in buffer, if needed
        cache().load_tasks()
        cache().update_vwtasks_from_tasks()
        cache().update_vwtasks_in_buffer()

        # Output the feedback from TW
        if output:
            print(output[-1])

        cache().buffer.push()
        self.save_action('modify', modstring)
Example #2
0
    def annotate(self, annotation):
        if not annotation:
            with util.current_line_highlighted():
                annotation = util.get_input("Enter annotation: ")

        for vimwikitask in self.tasks:
            vimwikitask.task.add_annotation(annotation)
            print("Task \"{0}\" annotated.".format(vimwikitask['description']))