1198
}
1199
positional(key: string, opts: PositionalDefinition): YargsInstance {
1200
>
argsert('<string> <object>', [key, opts], arguments.length);
yargs-factory.ts
1201
>
// .positional() only supports a subset of the configuration
1202
>
// options available to .option():
1203
>
const supportedOpts: (keyof PositionalDefinition)[] = [
1204
>
'default',
1205
>
'defaultDescription',
1206
>
'implies',
1207
>
'normalize',
1208
>
'choices',
1209
>
'conflicts',
1210
>
'coerce',
1211
>
'type',
1212
>
'describe',
1213
>
'desc',
1214
>
'description',
1215
>
'alias',
1216
>
];
1217
>
opts = objFilter(opts, (k, v) => {
1218
// type can be one of string|number|boolean.
1219
if (k === 'type' && !['string', 'number', 'boolean'].includes(v))
1220
return false;
1221
return supportedOpts.includes(k);
1223
>
1224
>
// copy over any settings that can be inferred from the command string.
1225
>
const fullCommand =
1226
>
this.#context.fullCommands[this.#context.fullCommands.length - 1];
1227
>
const parseOptions = fullCommand
1228
>
? this.#command.cmdToParseOptions(fullCommand)
1229
>
: {
1230
array: [],
1231
alias: {},