コマンダーの使用に問題があります: https://github.com/tj/commander.js/
program
.command('school')
.arguments("<year>")
.option("--month <month>", "specify month")
.parse(process.argv)
.action(function (year) {
console.log(`the year is ${year} and the month is ${program.month}`);
});
理由はわかりませんが、program.month
で実行しても未定義--month 12
です。
前もって感謝します。