Hi all,
My name is Murat Sutunc, I'm part of the Visual Studio team @ Microsoft and new 
to Cordova.

I was looking at the Cordova Tooling Wiki at 
(https://wiki.apache.org/cordova/CommandLineToolingDesign) and thought it would 
be interesting to make some additions to the list-devices feature. Currently we 
have list-devices and list-emulator-images scripts for a lot of different 
platforms. However these scripts are not easily accessible from the Cordova 
CLI. By introducing an additional argument to the run or emulate command, we 
could show a list of available emulators or connected devices. (I would like to 
deemphasize the fact that the command is called --list). After invoking the 
command, a user can decide which target to use and run the app on the desired 
target by using cordova run -device devicename

Here's how it looks for an Android only project:
C:\dev\cordova-projects\hello>cordova run --list
Running command: 
C:\dev\cordova-projects\hello\platforms\android\cordova\run.bat --list
Available Android Virtual Devices:
        AVD_GalaxyNexus_ToolsForApacheCordova
Available Android Devices:

(Internally what happens here is, through run.js we will call android list and 
adb devices and pipe that list to the user. Similar process with iOS too.)

Note that in case a platform doesn't support --list flag, it'll ignore the flag 
and run as if the flag is not provided. This is due to current args parsing 
logic in platforms. Is this ok for the short term? I would hope that more 
platforms would support this option in the future.

Below are the pull requests for cordova-cli and cordova-android/cordova-ios 
that have this functionality implemented. I would like to hear your thoughts on 
this design, choice of the flag and if you think this feature would be a 
valuable addition to the CLI.

cordova-cli: https://github.com/apache/cordova-cli/pull/199
cordova-android: https://github.com/apache/cordova-android/pull/139
cordova-ios: https://github.com/apache/cordova-ios/pull/122

PS: My ICLA just got approved. You can also ping me anytime on #cordova, my 
name on irc is muratsu.

Thanks!
-Murat

Reply via email to