• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2018 - The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14r"""Reconnect args.
15
16Defines the reconnect arg parser that holds delete specific args.
17"""
18
19CMD_RECONNECT = "reconnect"
20
21
22def GetReconnectArgParser(subparser):
23    """Return the reconnect arg parser.
24
25    Args:
26       subparser: argparse.ArgumentParser that is attached to main acloud cmd.
27
28    Returns:
29        argparse.ArgumentParser with reconnect options defined.
30    """
31    reconnect_parser = subparser.add_parser(CMD_RECONNECT)
32    reconnect_parser.required = False
33    reconnect_parser.set_defaults(which=CMD_RECONNECT)
34    reconnect_parser.add_argument(
35        "--instance-names",
36        dest="instance_names",
37        nargs="+",
38        required=False,
39        help="The names of the instances that need to reconnect remote/local "
40        "instances. For remote instances, it is the GCE instance name. "
41        "For local instances, it's the local keyword, e.g. --instance-names "
42        "local-instance")
43    reconnect_parser.add_argument(
44        "--all",
45        action="store_true",
46        dest="all",
47        required=False,
48        help="If more than 1 AVD instance is found, reconnect them all.")
49    reconnect_parser.add_argument(
50        "--autoconnect",
51        type=str,
52        nargs="?",
53        const=True,
54        dest="autoconnect",
55        required=False,
56        choices=[True, "adb"],
57        default=True,
58        help="If need adb only, you can pass in 'adb' here.")
59
60    return reconnect_parser
61