From 77fa0992a83fc6f7d2283f0155590cab1b8c267e Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Thu, 14 Sep 2023 11:11:59 +0200 Subject: [PATCH] python tool: refactor --- cli/python/app.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cli/python/app.py b/cli/python/app.py index 0020d8b..7f462b8 100644 --- a/cli/python/app.py +++ b/cli/python/app.py @@ -36,7 +36,6 @@ def editnote(note): if newcontent != content: - listnotes() subprocess.call(settings["commands"]["diff"] + ["data/backupnote.md", "data/note.md"]) note["content"] = newcontent @@ -53,7 +52,6 @@ def editnote(note): else: writetextfile("data/local.json", json.dumps(data)) else: - listnotes() print("no change") settings = json.loads(readtextfile("settings.json")) @@ -80,7 +78,7 @@ while not (command == "quit" or command == "exit" or command == "q"): index = int(command) note = data[index] except: - note = next((x for x in data if x["title"] == command), None) + note = next((note for note in data if note["title"] == command), None) if note: editnote(note) @@ -96,7 +94,5 @@ while not (command == "quit" or command == "exit" or command == "q"): } data.insert(0, note) editnote(note) - else: - listnotes() command = input("> ")