yargs#PositionalOptions TypeScript Examples
The following examples show how to use
yargs#PositionalOptions.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Runner.ts From mpflow with MIT License | 6 votes |
/**
* 注册 CLI 命令
* @param command
* @param describe
* @param positional
* @param options
* @param handler
*/
registerCommand<
P extends Record<string, PositionalOptions> = Record<string, PositionalOptions>,
O extends Record<string, Options> = Record<string, Options>
>(
command: CommandModule['command'],
describe: CommandModule['describe'],
positional: P,
options: O,
handler: (args: Arguments<InferredOptionTypes<P> & InferredOptionTypes<O>>) => void,
): void {
this.service.registerCommand(command, describe, positional, options, handler)
}
Example #2
Source File: Runner.ts From mpflow with MIT License | 6 votes |
/**
* 注册 CLI 命令
* @param command
* @param describe
* @param positional
* @param options
* @param handler
*/
registerCommand<
P extends Record<string, PositionalOptions> = Record<string, PositionalOptions>,
O extends Record<string, Options> = Record<string, Options>
>(
command: CommandModule['command'],
describe: CommandModule['describe'],
positional: P,
options: O,
handler: (args: Arguments<InferredOptionTypes<P> & InferredOptionTypes<O>>) => void,
): void {
this._registerCommand(
command,
describe,
yargs => {
Object.keys(positional).forEach(key => (yargs = yargs.positional(key, positional[key])))
yargs = yargs.options(options)
return yargs
},
handler,
)
}