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.

_images/adb.common_cli.MakeSubparser.CALL_GRAPH.svg
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.Action

A positional CLI argument.

_images/adb.common_cli.PositionalArg.CALL_GRAPH.svg
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.

_images/adb.common_cli.StartCli.CALL_GRAPH.svg
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.

_images/adb.common_cli._DocToArgs.CALLER_GRAPH.svg
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.Action

TODO

_images/adb.common_cli._PortPathAction.CALL_GRAPH.svg
adb.common_cli._RunMethod(dev, args, extra)[source]

Runs a method registered via MakeSubparser().

_images/adb.common_cli._RunMethod.CALLER_GRAPH.svg
Parameters
  • dev (TODO) – TODO

  • args (TODO) – TODO

  • extra (TODO) – TODO

Returns

0

Return type

int