INNER CODE UNIT · TypeScript
generateCommandDef
napi-rs/napi-rs · cli/codegen/index.ts:103
export function generateCommandDef(command: CommandSchema) {
const commandPath = kebabCase(command.name)
const avoidList = ['path', 'name']
const avoidName = (name: string) => {
return avoidList.includes(name) ? '$$' + name : name
}
const prepare: string[] = []
const cmdLines: string[] = []
let paths = `[['${commandPath}']]`
if (command.alias) {
command.alias.unshift(commandPath)
paths = `[${command.alias.map((alias) => `['${alias}']`).join(', ')}]`
}