Skip to content

Commit 1e0d9c5

Browse files
committed
fix(cli): strict mode
1 parent 63db02e commit 1e0d9c5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/slidev/node/cli.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const cli = yargs
1616
.scriptName('slidev')
1717
.usage('$0 [args]')
1818
.version(version)
19+
.strict()
1920
.showHelpOnFail(false)
2021
.alias('h', 'help')
2122
.alias('v', 'version')
@@ -41,6 +42,7 @@ cli.command(
4142
choices: ['error', 'warn', 'info', 'silent'],
4243
describe: 'log level',
4344
})
45+
.strict()
4446
.help(),
4547
async({ entry, theme, port, open, log }) => {
4648
if (!fs.existsSync(entry) && !entry.endsWith('.md'))
@@ -120,6 +122,7 @@ cli.command(
120122
type: 'boolean',
121123
describe: 'allow download as PDF',
122124
})
125+
.strict()
123126
.help(),
124127
async({ entry, theme, watch, base, download, out }) => {
125128
const { build } = await import('./build')
@@ -143,6 +146,7 @@ cli.command(
143146
'format [entry]',
144147
'Format the markdown file',
145148
args => commonOptions(args)
149+
.strict()
146150
.help(),
147151
async({ entry }) => {
148152
const data = await parser.load(entry)
@@ -174,6 +178,7 @@ cli.command(
174178
type: 'string',
175179
describe: 'page ranges to export, for example "1,4-5,6"',
176180
})
181+
.strict()
177182
.help(),
178183
async({
179184
entry,
@@ -214,7 +219,9 @@ cli.command(
214219
},
215220
)
216221

217-
cli.help().parse()
222+
cli
223+
.help()
224+
.parse()
218225

219226
function commonOptions(args: Argv<{}>) {
220227
return args

0 commit comments

Comments
 (0)