apache / cordova-plugman

Apache Cordova Plugman
https://cordova.apache.org/
Apache License 2.0
401 stars 151 forks source link

update main.js to fix cli_opts.platform_name value is true #109

Closed szx9231 closed 5 years ago

szx9231 commented 5 years ago

i find the cli_opts.platform_name value is true after call nopt(known_opts, shortHands). the expect value is android or ios.

Platforms affected

windows10 x64 node v8.15.0 cordova 9.0.0

Motivation and Context

when i run command plugman platform add --platform_name android i got below error:

(node:14820) UnhandledPromiseRejectionWarning: Error: platform: true not yet supported
    at Object.add (C:\node-v8.15.0-win-x86\node_modules\plugman\node_modules\cordova-lib\src\plugman\platform.js:51:35)
    at Object.module.exports [as platform] (C:\node-v8.15.0-win-x86\node_modules\plugman\node_modules\cordova-lib\src\plugman\platform_operation.js:23:38)
    at Object.platform (C:\node-v8.15.0-win-x86\node_modules\plugman\node_modules\cordova-lib\src\plugman\plugman.js:153:17)
    at Object.<anonymous> (C:\node-v8.15.0-win-x86\node_modules\plugman\main.js:87:42)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)
(node:14820) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:14820) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Description

change know_opts.platform to know_opts.platform_name to fix.

Closes #110

Testing

in my env it works well

Checklist

raphinesse commented 5 years ago

This would break the --platform option of plugman install. Closing in favor of #112