From ce2468705b141d68f46095f799920cf6325e2d1e Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sun, 12 Nov 2023 14:27:53 -0800 Subject: [PATCH] feat: option to specify npx quartz sync message (closes #583) --- quartz/cli/args.js | 5 +++++ quartz/cli/handlers.js | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/quartz/cli/args.js b/quartz/cli/args.js index 3543e2e8..7ed5b078 100644 --- a/quartz/cli/args.js +++ b/quartz/cli/args.js @@ -41,6 +41,11 @@ export const SyncArgv = { default: true, describe: "create a git commit for your unsaved changes", }, + message: { + string: true, + alias: ["m"], + describe: "option to override the default Quartz commit message", + }, push: { boolean: true, default: true, diff --git a/quartz/cli/handlers.js b/quartz/cli/handlers.js index 48a44ec9..96ee9bc8 100644 --- a/quartz/cli/handlers.js +++ b/quartz/cli/handlers.js @@ -483,8 +483,9 @@ export async function handleSync(argv) { dateStyle: "medium", timeStyle: "short", }) + const commitMessage = argv.message ?? `Quartz sync: ${currentTimestamp}` spawnSync("git", ["add", "."], { stdio: "inherit" }) - spawnSync("git", ["commit", "-m", `Quartz sync: ${currentTimestamp}`], { stdio: "inherit" }) + spawnSync("git", ["commit", "-m", commitMessage], { stdio: "inherit" }) if (contentStat.isSymbolicLink()) { // put symlink back