1#!/usr/bin/env python 2# 3# Copyright 2016 - 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. 16 17"""Common code used by both acloud and acloud_kernel tools.""" 18 19DEFAULT_CONFIG_FILE = "acloud.config" 20 21 22def AddCommonArguments(parser): 23 """Adds arguments common to parsers. 24 25 Args: 26 parser: ArgumentParser object, used to parse flags. 27 """ 28 parser.add_argument("--email", 29 type=str, 30 dest="email", 31 help="Email account to use for authentcation.") 32 parser.add_argument( 33 "--config_file", 34 type=str, 35 dest="config_file", 36 default=DEFAULT_CONFIG_FILE, 37 help="Path to the config file, default to acloud.config" 38 "in the current working directory") 39 parser.add_argument("--report_file", 40 type=str, 41 dest="report_file", 42 default=None, 43 help="Dump the report this file in json format. " 44 "If not specified, just log the report") 45 parser.add_argument("--log_file", 46 dest="log_file", 47 type=str, 48 default=None, 49 help="Path to log file.") 50 parser.add_argument("-v", 51 dest="verbose", 52 action="store_true", 53 default=False, 54 help="Verbose mode") 55 parser.add_argument("-vv", 56 dest="very_verbose", 57 action="store_true", 58 default=False, 59 help="Very verbose mode") 60