如何从钩子中退出 "cordova build" 命令?
How to exit a "cordova build" command from a hook?
我在 after_prepare 上使用带钩子的 Cordova。
如果命令不正确,我想退出。
例如,这个命令是正确的:
cordova run android --ENV=PRD
这个不正确,我希望 Cordova 的生命周期被中断:
cordova run android --ENV=AEZAZEZ
我的钩子看起来像:
module.exports = function(ctx) {
var env = ctx.opts.options.ENV;
if ( !CONFIG[env] ) {
// there is a problem in the CLI, I want to exit
} else {
如何修改挂钩以退出 Cordova 运行 命令?
抛出未处理的异常:
if ( !CONFIG[env] ) {
throw "there is a problem in the CLI, I want to exit";
}
我在 after_prepare 上使用带钩子的 Cordova。 如果命令不正确,我想退出。
例如,这个命令是正确的:
cordova run android --ENV=PRD
这个不正确,我希望 Cordova 的生命周期被中断:
cordova run android --ENV=AEZAZEZ
我的钩子看起来像:
module.exports = function(ctx) {
var env = ctx.opts.options.ENV;
if ( !CONFIG[env] ) {
// there is a problem in the CLI, I want to exit
} else {
如何修改挂钩以退出 Cordova 运行 命令?
抛出未处理的异常:
if ( !CONFIG[env] ) {
throw "there is a problem in the CLI, I want to exit";
}