I am recently looking into how appium works and wonder how the subcommand gets picked up by the source code.
For example these commands,
appium driver install flutter
appium driver install xcuitest
I trace it back to packages/appium/lib/main.js
then I see main
calls for init
function and pas the args. Is the args contain all the sub command
? I seem to lose track after that. Not really sure where init
is using all the sub command
and how init
works.
I would appreciate it if you share more about how main
and init
work.
Cheers!
You are right. The argument parsing logic lies in the init
function.
This function:
- resolves Appium home folder to load extensions and drivers from
- sets up modules load path for extensions and drivers being loaded
- parses command line arguments (either from CLI or a config file)
- creates server instance and prepares parsed config arguments if given arguments are related to the server
- passes arguments to the appropriate driver if needed
Consider checking the ArgParser class to get more info about how command line arguments are being parsed
1 Like
Also check runExtensionCommand
method implemntation to know more about driver
or plugin
subcommands processing
1 Like