Example #1
0
def deletenote(docopt_args):
    noteid = docopt_args["<note_id>"]
    note = NoteOperations()

    if docopt_args["-a"]:
        puts("Are you sure you want to delete all notes? [" +
             colored.red("y") + "][" + colored.green("n") + "]")
        answer = raw_input(">")
        if answer == "y":
            status = note.delete(noteid, "all")
        else:
            return
    else:
        puts("Are you sure you want to delete note " +
             str(note.getnotetitle(noteid)) + "? [" + colored.red("y") + "][" +
             colored.green("n") + "]")
        answer = raw_input(">")
        if answer == "y":
            notetitle = note.getnotetitle(noteid)
            status = note.delete(noteid, "one")
        else:
            return

    if status > 0:
        with indent(4, quote=' √'):
            if docopt_args["-a"]:
                puts(colored.red("Successfully deleted all notes"))
                note = NoteOperations()
                note.deletenotesfromcloud()
            else:
                puts(
                    colored.red("Successfully deleted note ") +
                    colored.yellow(notetitle))
                note = NoteOperations()
                note.synctocloud()
    else:
        with indent(4, quote=' √'):
            puts(
                colored.red("Sorry,the note with id ") +
                colored.green(noteid) + colored.red(" does not exist"))
Example #2
0
def deletenote(docopt_args):
    noteid = docopt_args["<note_id>"]
    note = NoteOperations()

    if docopt_args["-a"]:
        puts(
            "Are you sure you want to delete all notes? [" + colored.red("y") + "][" + colored.green("n") + "]")
        answer = raw_input(">")
        if answer == "y":
            status = note.delete(noteid, "all")
        else:
            return
    else:
        puts("Are you sure you want to delete note " + str(note.getnotetitle(noteid)
                                                           ) + "? [" + colored.red("y") + "][" + colored.green("n") + "]")
        answer = raw_input(">")
        if answer == "y":
            notetitle = note.getnotetitle(noteid)
            status = note.delete(noteid, "one")
        else:
            return

    if status > 0:
        with indent(4, quote=' √'):
            if docopt_args["-a"]:
                puts(colored.red("Successfully deleted all notes"))
                note = NoteOperations()
                note.deletenotesfromcloud()
            else:
                puts(colored.red("Successfully deleted note ") +
                     colored.yellow(notetitle))
                note = NoteOperations()
                note.synctocloud()
    else:
        with indent(4, quote=' √'):
            puts(colored.red("Sorry,the note with id ") +
                 colored.green(noteid) + colored.red(" does not exist"))