Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node.js で CLI アプリ ー デフォルト設定を定義する #1257

Closed
dogatana opened this issue Sep 6, 2020 · 2 comments · Fixed by #1264
Closed

Node.js で CLI アプリ ー デフォルト設定を定義する #1257

dogatana opened this issue Sep 6, 2020 · 2 comments · Fixed by #1264
Assignees

Comments

@dogatana
Copy link
Contributor

dogatana commented Sep 6, 2020

該当ページ

説明

次のコードは説明文から --gfm が指定されていない場合、デフォルトの false が有効(=上書きされない) ことを意図されていると理解しましたが、--gfm が指定されていない場合、program.opts(){ gfm: undefined } となり、undefined で上書きされてしまう挙動となりました。

const cliOptions = {
    gfm: false,
    ...program.opts(),
};
@lacolaco
Copy link
Collaborator

スプレッドではなく gfm: program.opts().gfm ?? false だといいのかな?ES2020対応もしたし

@lacolaco
Copy link
Collaborator

今週末テストしてみます

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants