a5 = prompt(q5, style=style) try: eval(a5["function"]) except Exception as e: puts(colored.red(e)) elif a1["command"] == "Query": q4 = [{ "type": "confirm", "name": "display", "message": "Do you want to display output table of the query?", "default": False, }] a4 = prompt(q4, style=style) q5 = [{ "type": "input", "name": "query", "message": "Write Any valid SQL query", "validate": lambda text: len(text) != 0 or "Enter a valid SQL query", }] a5 = prompt(q5, style=style) try: s = db.display_query(a5["query"], a4["display"]) puts(colored.green('Query "{}" executed successfully'.format(s))) except Exception as e: puts(colored.red(e))
"type": "input", "message": "Enter name of the app", "name": "search", "validate": lambda text: len(text) != 0 or "Field can't be empty.", }] a9 = prompt(q9, style=style) s = db.get("app", "appname, appid", where="name='{}'".format(a9["search"]), output=False) apps = db.display_query(s, output=False) if apps == []: puts( colored.red("{} does not exist in database.".format( a9["search"]))) else: apps = dict(apps) for i in apps.keys(): q4[0]["choices"].append({"name": i}) a4 = prompt(q4, style=style) if a4["install"] == []: puts(colored.red("You have to select at least one app.")) else: for i in a4["install"]: s = db.download(a1["userid"], apps[i])