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 19from acloud.internal import constants 20 21CMD_RECONNECT = "reconnect" 22 23 24def GetReconnectArgParser(subparser): 25 """Return the reconnect arg parser. 26 27 Args: 28 subparser: argparse.ArgumentParser that is attached to main acloud cmd. 29 30 Returns: 31 argparse.ArgumentParser with reconnect options defined. 32 """ 33 reconnect_parser = subparser.add_parser(CMD_RECONNECT) 34 reconnect_parser.required = False 35 reconnect_parser.set_defaults(which=CMD_RECONNECT) 36 reconnect_parser.add_argument( 37 "--instance-names", 38 dest="instance_names", 39 nargs="+", 40 required=False, 41 help="The names of the instances that need to reconnect remote/local " 42 "instances. For remote instances, it is the GCE instance name. " 43 "For local instances, it's the local keyword, e.g. --instance-names " 44 "local-instance") 45 reconnect_parser.add_argument( 46 "--all", 47 action="store_true", 48 dest="all", 49 required=False, 50 help="If more than 1 AVD instance is found, reconnect them all.") 51 reconnect_parser.add_argument( 52 "--autoconnect", 53 type=str, 54 nargs="?", 55 dest="autoconnect", 56 required=False, 57 choices=[constants.INS_KEY_VNC, constants.INS_KEY_ADB, 58 constants.INS_KEY_WEBRTC], 59 help="If need adb only, you can pass in 'adb' here.") 60 61 return reconnect_parser 62