def nextquery(docopt_args): values = readvaluescache() if len(values) > 0: op = values.get("op", "") if op == "list": skip = values.get("skip", "") note = NoteOperations() allnotes = note.viewallskip(str(skip), str(skip)) if len(allnotes) > 0: insertvaluecache("list", str(int(skip) + int(skip)), "") for item in allnotes: noteid = item.get("_id", "") time = "[" + item.get("datecreated", "") + "]" noteids = "[" + str(noteid) + "]" body = item.get("body", "") title = item.get("title", "========NOT FOUND=======") print(Fore.YELLOW + "===============================================" + Fore.RESET) print(Back.BLUE + noteids + Back.RESET + " " + Back.BLUE + time + Back.RESET + "\n\n" + Back.RED + title + Back.RESET + Style.BRIGHT + "\n\n" + Fore.GREEN + body + Fore.RESET + Style.NORMAL) print(Fore.YELLOW + "===============================================" + Fore.RESET) else: with indent(4): puts(colored.yellow("End of notes")) elif op == "search": skip = values.get("skip", "") query = values.get("query", "") note = NoteOperations() allnotes = note.searchskip(query, str(skip), str(skip)) if len(allnotes) > 0: insertvaluecache("search", str(int(skip) + int(skip)), query) for item in allnotes: noteid = item.get("_id", "") time = "[" + item.get("datecreated", "") + "]" noteids = "[" + str(noteid) + "]" body = item.get("body", "") title = item.get("title", "========NOT FOUND=======") print(Fore.YELLOW + "===============================================" + Fore.RESET) print(Back.BLUE + noteids + Back.RESET + " " + Back.BLUE + time + Back.RESET + "\n\n" + Back.RED + title + Back.RESET + Style.BRIGHT + "\n\n" + Fore.GREEN + body + Fore.RESET + Style.NORMAL) print(Fore.YELLOW + "===============================================" + Fore.RESET) else: with indent(4): puts(colored.yellow("End of notes")) else: pass
def nextquery(docopt_args): values = readvaluescache() if len(values) > 0: op = values.get("op", "") if op == "list": skip = values.get("skip", "") note = NoteOperations() allnotes = note.viewallskip(str(skip), str(skip)) if len(allnotes) > 0: insertvaluecache("list", str(int(skip) + int(skip)), "") for item in allnotes: noteid = item.get("_id", "") time = "["+ item.get("datecreated", "") + "]" noteids = "["+ str(noteid) + "]" body = item.get("body", "") title = item.get("title", "========NOT FOUND=======") print(Fore.YELLOW + "===============================================" + Fore.RESET) print(Back.BLUE + noteids + Back.RESET +" " + Back.BLUE + time + Back.RESET +"\n\n" + Back.RED + title + Back.RESET + Style.BRIGHT +"\n\n"+ Fore.GREEN + body + Fore.RESET + Style.NORMAL) print(Fore.YELLOW + "===============================================" + Fore.RESET) else: with indent(4): puts(colored.yellow("End of notes")) elif op == "search": skip = values.get("skip", "") query = values.get("query", "") note = NoteOperations() allnotes = note.searchskip(query, str(skip), str(skip)) if len(allnotes) > 0: insertvaluecache("search", str(int(skip) + int(skip)), query) for item in allnotes: noteid = item.get("_id", "") time = "["+ item.get("datecreated", "") + "]" noteids = "["+ str(noteid) + "]" body = item.get("body", "") title = item.get("title", "========NOT FOUND=======") print(Fore.YELLOW + "===============================================" + Fore.RESET) print(Back.BLUE + noteids + Back.RESET +" " + Back.BLUE + time + Back.RESET +"\n\n" + Back.RED + title + Back.RESET + Style.BRIGHT +"\n\n"+ Fore.GREEN + body + Fore.RESET + Style.NORMAL) print(Fore.YELLOW + "===============================================" + Fore.RESET) else: with indent(4): puts(colored.yellow("End of notes")) else: pass