Example #1
0
def importnotes(docopt_args):
    filename = docopt_args["<filename>"] + ".csv"
    if os.path.isfile(filename):
        with open(filename, 'rb') as f:
            reader = csv.reader(f)
            for row in reader:
                title = row[0]
                body = row[1]
                time = row[2]
                note = NoteOperations()
                note.save(title=title, body=body)
            with indent(4, quote=' >'):
                puts(colored.green("Import successful"))
            note.synctocloud()
    else:
        with indent(4, quote=' >'):
            puts(colored.red("Sorry,the file does not exist"))
Example #2
0
def importnotes(docopt_args):
    filename = docopt_args["<filename>"] + ".csv"
    if os.path.isfile(filename):
        with open(filename, 'rb') as f:
            reader = csv.reader(f)
            for row in reader:
                title = row[0]
                body = row[1]
                time = row[2]
                note = NoteOperations()
                note.save(title=title, body=body)
            with indent(4, quote=' >'):
                puts(colored.green("Import successful"))
            note.synctocloud()
    else:
        with indent(4, quote=' >'):
            puts(colored.red("Sorry,the file does not exist"))
Example #3
0
def createnewnote(docopt_args):
    notebody = ""
    if docopt_args["<note_title>"] and docopt_args["-m"]:
        with indent(4, quote=' >'):
            # puts(
            #     colored.yellow('Type the body of the notes.Press "/pq" to save & exit'))
            print(Back.YELLOW + Fore.RED + 'Type the body of the notes' + Back.RESET + Fore.RESET + Style.BRIGHT + ' (Press ' + Back.YELLOW + Fore.RED + "/pq" + Back.RESET + Fore.RESET + ' to save & exit)' + Style.NORMAL + Fore.GREEN)
        sentinel = '/pq'  # ends when this string is seen
        for line in iter(raw_input, sentinel):
            notebody += line + "\n"
    print(Fore.RESET)
    notetitle = docopt_args["<note_title>"]
    note = NoteOperations()
    note.save(title=notetitle, body=notebody)
    with indent(4, quote='√ '):
        puts(colored.green("Successfully saved"))
    note.synctocloud()
Example #4
0
def createnewnote(docopt_args):
    notebody = ""
    if docopt_args["<note_title>"] and docopt_args["-m"]:
        with indent(4, quote=' >'):
            # puts(
            #     colored.yellow('Type the body of the notes.Press "/pq" to save & exit'))
            print(Back.YELLOW + Fore.RED + 'Type the body of the notes' +
                  Back.RESET + Fore.RESET + Style.BRIGHT + ' (Press ' +
                  Back.YELLOW + Fore.RED + "/pq" + Back.RESET + Fore.RESET +
                  ' to save & exit)' + Style.NORMAL + Fore.GREEN)
        sentinel = '/pq'  # ends when this string is seen
        for line in iter(raw_input, sentinel):
            notebody += line + "\n"
    print(Fore.RESET)
    notetitle = docopt_args["<note_title>"]
    note = NoteOperations()
    note.save(title=notetitle, body=notebody)
    with indent(4, quote='√ '):
        puts(colored.green("Successfully saved"))
    note.synctocloud()