feat(napi): add -p flag which will be bypassed to cargo

This commit is contained in:
LongYinan 2021-12-03 16:29:03 +08:00
parent 96190f1c80
commit 8de30a9287
No known key found for this signature in database
GPG key ID: C3666B7FC82ADAD7

View file

@ -65,6 +65,10 @@ export class BuildCommand extends Command {
)} file, relative to cwd`,
})
project = Option.String('-p', {
description: `Bypass to ${chalk.green('cargo -p')}`,
})
cargoFlags = Option.String('--cargo-flags', '', {
description: `All the others flag passed to ${chalk.yellow('cargo')}`,
})
@ -123,10 +127,12 @@ export class BuildCommand extends Command {
}).toString('utf8'),
)
debug(`Current triple is: ${chalk.green(triple.raw)}`)
const pFlag = this.project ? `-p ${this.project}` : ''
const externalFlags = [
releaseFlag,
targetFlag,
featuresFlag,
pFlag,
this.cargoFlags,
]
.filter((flag) => Boolean(flag))