diff --git a/scripts/new-post.mjs b/scripts/new-post.mjs index 28e4c09..36a68be 100644 --- a/scripts/new-post.mjs +++ b/scripts/new-post.mjs @@ -24,6 +24,11 @@ function today() { const args = process.argv.slice(2) if (args.length === 0 || args[0] === "--help" || args[0] === "-h") { + // 无参数进来时先说清楚原因:下面 pnpm 还会补一句 + // "[ELIFECYCLE] Command failed with exit code 1",不点明的话很像脚本崩了 + if (args.length === 0) { + console.log('缺少文章标题,没有创建任何文件。\n正确写法:pnpm new-post "树莓派装 Docker 全程记录" --category 教程\n') + } console.log(`创建一篇新文章 用法: diff --git a/scripts/new-thought.mjs b/scripts/new-thought.mjs index 5717662..2fd8c69 100644 --- a/scripts/new-thought.mjs +++ b/scripts/new-thought.mjs @@ -33,6 +33,11 @@ function fileStamp() { const args = process.argv.slice(2) if (args.length === 0 || args[0] === "--help" || args[0] === "-h") { + // 无参数进来时先说清楚原因:下面 pnpm 还会补一句 + // "[ELIFECYCLE] Command failed with exit code 1",不点明的话很像脚本崩了 + if (args.length === 0) { + console.log('缺少正文内容,没有创建任何文件。\n正确写法:pnpm new-thought "今天把树莓派的散热换掉了。"\n') + } console.log(`创建一条新的「偶得」 用法: