From f716fb83f13486f637c97d0a7ed3b1345a6bbbd5 Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Mon, 11 Sep 2023 09:54:33 +0200 Subject: [PATCH] quickjs cli tool: changed: allow command line params for editor added: diff before push changed: bypass confimation message for encryption --- cli/quick/app.js | 7 +++++-- cli/quick/settingssample.json | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cli/quick/app.js b/cli/quick/app.js index c05e86a..82ad572 100644 --- a/cli/quick/app.js +++ b/cli/quick/app.js @@ -12,11 +12,14 @@ function editnote() file.puts(currentnote.content); file.close(); - os.exec([settings.editor, "data/note.md"]); + os.exec(["cp", "data/note.md", "data/backup.md"]); + + os.exec(settings.editor.concat("data/note.md")); var newcontent = std.loadFile("data/note.md"); if (currentnote.content != newcontent) { + os.exec(["diff", "--color", "data/backup.md", "data/note.md"]); currentnote.content = newcontent; notes.splice(notes.indexOf(currentnote), 1); @@ -26,7 +29,7 @@ function editnote() file.puts(JSON.stringify(notes)); file.close(); - os.exec([settings.gpg, "--encrypt", "--yes", "--output", "data/data2.acs", "--armor", "-r", settings.gpguser, "data/data2.json"]); + os.exec([settings.gpg, "--encrypt", "--yes", "--trust-model", "always", "--output", "data/data2.acs", "--armor", "-r", settings.gpguser, "data/data2.json"]); var newdata = std.loadFile("data/data2.acs"); console.log("sending data file to server..."); diff --git a/cli/quick/settingssample.json b/cli/quick/settingssample.json index 801993d..7ffece7 100644 --- a/cli/quick/settingssample.json +++ b/cli/quick/settingssample.json @@ -1,7 +1,7 @@ { "password": "", "url": "http://localhost:8000", - "editor": "vim", + "editor": ["vim"], "gpg": "gpg", "gpguser": "" }