1#!/usr/bin/env python
2#
3# Copyright 2019 - 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"""Pull args.
17
18Defines the pull arg parser that holds pull specific args.
19"""
20
21CMD_PULL = "pull"
22
23
24def GetPullArgParser(subparser):
25    """Return the pull arg parser.
26
27    Args:
28       subparser: argparse.ArgumentParser that is attached to main acloud cmd.
29
30    Returns:
31        argparse.ArgumentParser with pull options defined.
32    """
33    pull_parser = subparser.add_parser(CMD_PULL)
34    pull_parser.required = False
35    pull_parser.set_defaults(which=CMD_PULL)
36    pull_parser.add_argument(
37        "--instance-name",
38        dest="instance_name",
39        type=str,
40        required=False,
41        help="The name of the remote instance that need to pull log files.")
42    pull_parser.add_argument(
43        "--file-name",
44        dest="file_name",
45        type=str,
46        required=False,
47        help="The log file name to pull from the remote instance, "
48             "e.g. launcher.log, kernel.log.")
49    pull_parser.add_argument(
50        "--yes", "-y",
51        action="store_true",
52        dest="no_prompt",
53        required=False,
54        help="Assume 'yes' as an answer to the prompt when asking users about "
55             "file streaming.")
56
57    return pull_parser
58