blob: 4190223d6f27f1982a70e20a09d6e454fdffcbf2 [file] [log] [blame]
Kevin Chengee6030f2018-06-26 10:55:30 -07001#!/usr/bin/env python
2#
3# Copyright 2018 - The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16r"""Setup args.
17
18Defines the setup arg parser that holds setup specific args.
19"""
20
21CMD_SETUP = "setup"
22
23
24def GetSetupArgParser(subparser):
25 """Return the setup arg parser.
26
27 Args:
28 subparser: argparse.ArgumentParser that is attached to main acloud cmd.
29
30 Returns:
31 argparse.ArgumentParser with setup options defined.
32 """
33 setup_parser = subparser.add_parser(CMD_SETUP)
34 setup_parser.required = False
35 setup_parser.set_defaults(which=CMD_SETUP)
Sam Chiu81bdc652018-06-29 18:45:08 +080036 setup_parser.add_argument(
37 "--host",
38 action="store_true",
39 dest="host",
40 required=False,
Kevin Cheng92532b42019-02-12 10:03:13 -080041 help="Setup host to run local instance of an Android Virtual Device. "
Kevin Chengeb997272019-06-05 14:53:18 -070042 "Must explicitly set to kick off host setup. Automatically installs "
43 "host base packages as well")
44 setup_parser.add_argument(
45 "--host-base",
46 action="store_true",
47 dest="host_base",
48 required=False,
49 help="Install base packages on the host.")
herbertxue34776bb2018-07-03 21:57:48 +080050 setup_parser.add_argument(
cylan76b61c62019-01-19 13:59:09 +080051 "--gcp-init",
herbertxue34776bb2018-07-03 21:57:48 +080052 action="store_true",
53 dest="gcp_init",
54 required=False,
55 help="Setup Google Cloud project name and enable required GCP APIs."
Kevin Chengeb997272019-06-05 14:53:18 -070056 "E.G. Google Cloud Storage/ Internal Android Build/ Compute Engine")
Kevin Cheng58b7e792018-10-05 02:26:53 -070057 setup_parser.add_argument(
58 "--force",
59 action="store_true",
60 dest="force",
61 required=False,
62 help="Force the setup steps even if it's not required.")
herbertxuec0f98f32020-05-20 14:00:56 +080063 # TODO(157532869): Validate the field name.
64 setup_parser.add_argument(
65 "--update-config",
66 nargs=2,
67 dest="update_config",
68 required=False,
69 help="Update the acloud user config. The first arg is field name in "
70 "config, and the second arg is the value of the field. Command would "
71 "like: 'acloud setup --config stable_host_image_family acloud-release'")
Kevin Cheng58b7e792018-10-05 02:26:53 -070072
Kevin Chengee6030f2018-06-26 10:55:30 -070073 return setup_parser