adb.common_cli module¶
Common code for ADB and Fastboot CLI.
Usage introspects the given class for methods, args, and docs to show the user.
StartCli() handles connecting to a device, calling the expected method, and
outputting the results.
Contents
-
adb.common_cli.GetCommonArguments()[source]¶ Return a parser for common CLI commands.
- Returns
group – A parser for common CLI commands.
- Return type
argparse.ArgumentParser
-
adb.common_cli.GetDeviceArguments()[source]¶ Return a parser for device-related CLI commands.
- Returns
group – A parser for device-related CLI commands.
- Return type
argparse.ArgumentParser
-
adb.common_cli.MakeSubparser(subparsers, parents, method, arguments=None)[source]¶ Returns an argparse subparser to create a ‘subcommand’ to adb.
- Parameters
subparsers (TODO) – TODO
parents (TODO) – TODO
method (TODO) – TODO
arguments (TODO, None) – TODO
- Returns
subparser – TODO
- Return type
TODO
-
class
adb.common_cli.PositionalArg(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]¶ Bases:
argparse.ActionA positional CLI argument.
-
adb.common_cli.StartCli(args, adb_commands, extra=None, **device_kwargs)[source]¶ Starts a common CLI interface for this usb path and protocol.
Handles connecting to a device, calling the expected method, and outputting the results.
- Parameters
args (TODO) – TODO
adb_commands (TODO) – TODO
extra (TODO, None) – TODO
**device_kwargs (TODO) – TODO
- Returns
TODO
- Return type
TODO
-
adb.common_cli._DocToArgs(doc)[source]¶ Converts a docstring documenting arguments into a dict.
- Parameters
doc (str) – The docstring for a method; see MakeSubparser.
- Returns
out – A dictionary of arguments and their descriptions from the docstring
doc.- Return type
dict
-
class
adb.common_cli._PortPathAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]¶ Bases:
argparse.ActionTODO
-
adb.common_cli._RunMethod(dev, args, extra)[source]¶ Runs a method registered via
MakeSubparser().- Parameters
dev (TODO) – TODO
args (TODO) – TODO
extra (TODO) – TODO
- Returns
0
- Return type
int