Home | History | Annotate | Download | only in sdkmanager
      1 /*
      2  * Copyright (C) 2008 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.sdkmanager;
     18 
     19 import com.android.sdklib.ISdkLog;
     20 import com.android.sdklib.SdkManager;
     21 import com.android.sdklib.repository.SdkRepoConstants;
     22 
     23 import java.util.Arrays;
     24 
     25 
     26 /**
     27  * Specific command-line flags for the {@link SdkManager}.
     28  */
     29 class SdkCommandLine extends CommandLineProcessor {
     30 
     31     /*
     32      * Steps needed to add a new action:
     33      * - Each action is defined as a "verb object" followed by parameters.
     34      * - Either reuse a VERB_ constant or define a new one.
     35      * - Either reuse an OBJECT_ constant or define a new one.
     36      * - Add a new entry to mAction with a one-line help summary.
     37      * - In the constructor, add a define() call for each parameter (either mandatory
     38      *   or optional) for the given action.
     39      */
     40 
     41     public final static String VERB_LIST    = "list";                               //$NON-NLS-1$
     42     public final static String VERB_CREATE  = "create";                             //$NON-NLS-1$
     43     public final static String VERB_MOVE    = "move";                               //$NON-NLS-1$
     44     public final static String VERB_DELETE  = "delete";                             //$NON-NLS-1$
     45     public final static String VERB_UPDATE  = "update";                             //$NON-NLS-1$
     46     public final static String VERB_SDK     = "sdk";                                //$NON-NLS-1$
     47     public final static String VERB_AVD     = "avd";                                //$NON-NLS-1$
     48 
     49     public static final String OBJECT_SDK            = "sdk";                       //$NON-NLS-1$
     50     public static final String OBJECT_AVD            = "avd";                       //$NON-NLS-1$
     51     public static final String OBJECT_AVDS           = "avds";                      //$NON-NLS-1$
     52     public static final String OBJECT_TARGET         = "target";                    //$NON-NLS-1$
     53     public static final String OBJECT_TARGETS        = "targets";                   //$NON-NLS-1$
     54     public static final String OBJECT_PROJECT        = "project";                   //$NON-NLS-1$
     55     public static final String OBJECT_TEST_PROJECT   = "test-project";              //$NON-NLS-1$
     56     public static final String OBJECT_LIB_PROJECT    = "lib-project";               //$NON-NLS-1$
     57     public static final String OBJECT_ADB            = "adb";                       //$NON-NLS-1$
     58     public static final String OBJECT_IDENTITY       = "identity";                  //$NON-NLS-1$
     59 
     60     public static final String ARG_ALIAS        = "alias";                          //$NON-NLS-1$
     61     public static final String ARG_ACTIVITY     = "activity";                       //$NON-NLS-1$
     62 
     63     public static final String KEY_ACTIVITY     = ARG_ACTIVITY;
     64     public static final String KEY_PACKAGE      = "package";                        //$NON-NLS-1$
     65     public static final String KEY_MODE         = "mode";                           //$NON-NLS-1$
     66     public static final String KEY_TARGET_ID    = OBJECT_TARGET;
     67     public static final String KEY_NAME         = "name";                           //$NON-NLS-1$
     68     public static final String KEY_LIBRARY      = "library";                        //$NON-NLS-1$
     69     public static final String KEY_PATH         = "path";                           //$NON-NLS-1$
     70     public static final String KEY_FILTER       = "filter";                         //$NON-NLS-1$
     71     public static final String KEY_SKIN         = "skin";                           //$NON-NLS-1$
     72     public static final String KEY_SDCARD       = "sdcard";                         //$NON-NLS-1$
     73     public static final String KEY_FORCE        = "force";                          //$NON-NLS-1$
     74     public static final String KEY_RENAME       = "rename";                         //$NON-NLS-1$
     75     public static final String KEY_SUBPROJECTS  = "subprojects";                    //$NON-NLS-1$
     76     public static final String KEY_MAIN_PROJECT = "main";                           //$NON-NLS-1$
     77     public static final String KEY_NO_UI        = "no-ui";                          //$NON-NLS-1$
     78     public static final String KEY_NO_HTTPS     = "no-https";                       //$NON-NLS-1$
     79     public static final String KEY_PROXY_PORT   = "proxy-port";                     //$NON-NLS-1$
     80     public static final String KEY_PROXY_HOST   = "proxy-host";                     //$NON-NLS-1$
     81     public static final String KEY_DRY_MODE     = "dry-mode";                       //$NON-NLS-1$
     82     public static final String KEY_OBSOLETE     = "obsolete";                       //$NON-NLS-1$
     83     public static final String KEY_EXTENDED     = "extended";                       //$NON-NLS-1$
     84     public static final String KEY_SNAPSHOT     = "snapshot";                       //$NON-NLS-1$
     85     public static final String KEY_COMPACT      = "compact";                        //$NON-NLS-1$
     86     public static final String KEY_EOL_NULL     = "null";                           //$NON-NLS-1$
     87     public static final String KEY_ABI          = "abi";                            //$NON-NLS-1$
     88     public static final String KEY_ACCOUNT      = "account";                        //$NON-NLS-1$
     89     public static final String KEY_KEYSTORE     = "keystore";                       //$NON-NLS-1$
     90     public static final String KEY_ALIAS        = "alias";                          //$NON-NLS-1$
     91     public static final String KEY_STOREPASS    = "storepass";                      //$NON-NLS-1$
     92     public static final String KEY_KEYPASS      = "keypass";                        //$NON-NLS-1$
     93 
     94     /**
     95      * Action definitions for SdkManager command line.
     96      * <p/>
     97      * This list serves two purposes: first it is used to know which verb/object
     98      * actions are acceptable on the command-line; second it provides a summary
     99      * for each action that is printed in the help.
    100      * <p/>
    101      * Each entry is a string array with:
    102      * <ul>
    103      * <li> the verb.
    104      * <li> an object (use #NO_VERB_OBJECT if there's no object).
    105      * <li> a description.
    106      * <li> an alternate form for the object (e.g. plural).
    107      * </ul>
    108      */
    109     private final static String[][] ACTIONS = {
    110 
    111             { VERB_SDK, NO_VERB_OBJECT,
    112                 "Displays the SDK Manager window." },
    113             { VERB_AVD, NO_VERB_OBJECT,
    114                 "Displays the AVD Manager window.",
    115                 },
    116 
    117             { VERB_LIST, NO_VERB_OBJECT,
    118                 "Lists existing targets or virtual devices." },
    119             { VERB_LIST, OBJECT_AVD,
    120                 "Lists existing Android Virtual Devices.",
    121                 OBJECT_AVDS },
    122             { VERB_LIST, OBJECT_TARGET,
    123                 "Lists existing targets.",
    124                 OBJECT_TARGETS },
    125             { VERB_LIST, OBJECT_SDK,
    126                 "Lists remote SDK repository." },
    127 
    128             { VERB_CREATE, OBJECT_AVD,
    129                 "Creates a new Android Virtual Device." },
    130             { VERB_MOVE, OBJECT_AVD,
    131                 "Moves or renames an Android Virtual Device." },
    132             { VERB_DELETE, OBJECT_AVD,
    133                 "Deletes an Android Virtual Device." },
    134             { VERB_UPDATE, OBJECT_AVD,
    135                 "Updates an Android Virtual Device to match the folders of a new SDK." },
    136 
    137             { VERB_CREATE, OBJECT_PROJECT,
    138                 "Creates a new Android project." },
    139             { VERB_UPDATE, OBJECT_PROJECT,
    140                 "Updates an Android project (must already have an AndroidManifest.xml)." },
    141 
    142             { VERB_CREATE, OBJECT_TEST_PROJECT,
    143                 "Creates a new Android project for a test package." },
    144             { VERB_UPDATE, OBJECT_TEST_PROJECT,
    145                 "Updates the Android project for a test package (must already have an AndroidManifest.xml)." },
    146 
    147             { VERB_CREATE, OBJECT_LIB_PROJECT,
    148                 "Creates a new Android library project." },
    149             { VERB_UPDATE, OBJECT_LIB_PROJECT,
    150                 "Updates an Android library project (must already have an AndroidManifest.xml)." },
    151 
    152             { VERB_UPDATE, OBJECT_ADB,
    153                 "Updates adb to support the USB devices declared in the SDK add-ons." },
    154 
    155             { VERB_UPDATE, OBJECT_SDK,
    156                 "Updates the SDK by suggesting new platforms to install if available." },
    157 
    158             { VERB_CREATE, OBJECT_IDENTITY,
    159                 "Creates an identity file." },
    160     };
    161 
    162     public SdkCommandLine(ISdkLog logger) {
    163         super(logger, ACTIONS);
    164 
    165         // The following defines the parameters of the actions defined in mAction.
    166 
    167         // --- list avds ---
    168 
    169         define(Mode.BOOLEAN, false,
    170                 VERB_LIST, OBJECT_AVD, "c", KEY_COMPACT,                            //$NON-NLS-1$
    171                 "Compact output (suitable for scripts)", false);
    172 
    173         define(Mode.BOOLEAN, false,
    174                 VERB_LIST, OBJECT_AVD, "0", KEY_EOL_NULL,                           //$NON-NLS-1$
    175                 "Terminates lines with \\0 instead of \\n (e.g. for xargs -0). Only used by --" + KEY_COMPACT + ".",
    176                 false);
    177 
    178         // --- list targets ---
    179 
    180         define(Mode.BOOLEAN, false,
    181                 VERB_LIST, OBJECT_TARGET, "c", KEY_COMPACT,                         //$NON-NLS-1$
    182                 "Compact output (suitable for scripts)", false);
    183 
    184         define(Mode.BOOLEAN, false,
    185                 VERB_LIST, OBJECT_TARGET, "0", KEY_EOL_NULL,                        //$NON-NLS-1$
    186                 "Terminates lines with \\0 instead of \\n (e.g. for xargs -0) Only used by --" + KEY_COMPACT + ".",
    187                 false);
    188 
    189         // --- create avd ---
    190 
    191         define(Mode.STRING, false,
    192                 VERB_CREATE, OBJECT_AVD, "p", KEY_PATH,                             //$NON-NLS-1$
    193                 "Directory where the new AVD will be created.", null);
    194         define(Mode.STRING, true,
    195                 VERB_CREATE, OBJECT_AVD, "n", KEY_NAME,                             //$NON-NLS-1$
    196                 "Name of the new AVD.", null);
    197         define(Mode.STRING, true,
    198                 VERB_CREATE, OBJECT_AVD, "t", KEY_TARGET_ID,                        //$NON-NLS-1$
    199                 "Target ID of the new AVD.", null);
    200         define(Mode.STRING, false,
    201                 VERB_CREATE, OBJECT_AVD, "s", KEY_SKIN,                             //$NON-NLS-1$
    202                 "Skin for the new AVD.", null);
    203         define(Mode.STRING, false,
    204                 VERB_CREATE, OBJECT_AVD, "c", KEY_SDCARD,                           //$NON-NLS-1$
    205                 "Path to a shared SD card image, or size of a new sdcard for the new AVD.", null);
    206         define(Mode.BOOLEAN, false,
    207                 VERB_CREATE, OBJECT_AVD, "f", KEY_FORCE,                            //$NON-NLS-1$
    208                 "Forces creation (overwrites an existing AVD)", false);
    209         define(Mode.BOOLEAN, false,
    210                 VERB_CREATE, OBJECT_AVD, "a", KEY_SNAPSHOT,                         //$NON-NLS-1$
    211                 "Place a snapshots file in the AVD, to enable persistence.", false);
    212         define(Mode.STRING, false,
    213                 VERB_CREATE, OBJECT_AVD, "b", KEY_ABI,                           //$NON-NLS-1$
    214                 "The ABI to use for the AVD. The default is to auto-select the ABI if the platform has only one ABI for its system images.",
    215                 null);
    216 
    217         // --- delete avd ---
    218 
    219         define(Mode.STRING, true,
    220                 VERB_DELETE, OBJECT_AVD, "n", KEY_NAME,                             //$NON-NLS-1$
    221                 "Name of the AVD to delete.", null);
    222 
    223         // --- move avd ---
    224 
    225         define(Mode.STRING, true,
    226                 VERB_MOVE, OBJECT_AVD, "n", KEY_NAME,                               //$NON-NLS-1$
    227                 "Name of the AVD to move or rename.", null);
    228         define(Mode.STRING, false,
    229                 VERB_MOVE, OBJECT_AVD, "r", KEY_RENAME,                             //$NON-NLS-1$
    230                 "New name of the AVD.", null);
    231         define(Mode.STRING, false,
    232                 VERB_MOVE, OBJECT_AVD, "p", KEY_PATH,                               //$NON-NLS-1$
    233                 "Path to the AVD's new directory.", null);
    234 
    235         // --- update avd ---
    236 
    237         define(Mode.STRING, true,
    238                 VERB_UPDATE, OBJECT_AVD, "n", KEY_NAME,                             //$NON-NLS-1$
    239                 "Name of the AVD to update", null);
    240 
    241         // --- list sdk ---
    242 
    243         define(Mode.BOOLEAN, false,
    244                 VERB_LIST, OBJECT_SDK, "u", KEY_NO_UI,                              //$NON-NLS-1$
    245                 "Displays list result on console (no GUI)", true);
    246 
    247         define(Mode.BOOLEAN, false,
    248                 VERB_LIST, OBJECT_SDK, "s", KEY_NO_HTTPS,                           //$NON-NLS-1$
    249                 "Uses HTTP instead of HTTPS (the default) for downloads.", false);
    250 
    251         define(Mode.STRING, false,
    252                 VERB_LIST, OBJECT_SDK, "", KEY_PROXY_PORT,                          //$NON-NLS-1$
    253                 "HTTP/HTTPS proxy port (overrides settings if defined)",
    254                 null);
    255 
    256         define(Mode.STRING, false,
    257                 VERB_LIST, OBJECT_SDK, "", KEY_PROXY_HOST,                          //$NON-NLS-1$
    258                 "HTTP/HTTPS proxy host (overrides settings if defined)",
    259                 null);
    260 
    261         define(Mode.BOOLEAN, false,
    262                 VERB_LIST, OBJECT_SDK, "o", KEY_OBSOLETE,                           //$NON-NLS-1$
    263                 "Lists all packages (including obsolete and installed ones)",
    264                 false);
    265 
    266         define(Mode.BOOLEAN, false,
    267                 VERB_LIST, OBJECT_SDK, "e", KEY_EXTENDED,                           //$NON-NLS-1$
    268                 "Displays extended details on each package",
    269                 false);
    270 
    271         // --- update sdk ---
    272 
    273         define(Mode.BOOLEAN, false,
    274                 VERB_UPDATE, OBJECT_SDK, "u", KEY_NO_UI,                            //$NON-NLS-1$
    275                 "Updates from command-line (does not display the GUI)", false);
    276 
    277         define(Mode.BOOLEAN, false,
    278                 VERB_UPDATE, OBJECT_SDK, "s", KEY_NO_HTTPS,                         //$NON-NLS-1$
    279                 "Uses HTTP instead of HTTPS (the default) for downloads.", false);
    280 
    281         define(Mode.STRING, false,
    282                 VERB_UPDATE, OBJECT_SDK, "", KEY_PROXY_PORT,                        //$NON-NLS-1$
    283                 "HTTP/HTTPS proxy port (overrides settings if defined)",
    284                 null);
    285 
    286         define(Mode.STRING, false,
    287                 VERB_UPDATE, OBJECT_SDK, "", KEY_PROXY_HOST,                        //$NON-NLS-1$
    288                 "HTTP/HTTPS proxy host (overrides settings if defined)",
    289                 null);
    290 
    291         define(Mode.BOOLEAN, false,
    292                 VERB_UPDATE, OBJECT_SDK, "f", KEY_FORCE,                            //$NON-NLS-1$
    293                 "Forces replacement of a package or its parts, even if something has been modified.",
    294                 false);
    295 
    296         define(Mode.STRING, false,
    297                 VERB_UPDATE, OBJECT_SDK, "t", KEY_FILTER,                           //$NON-NLS-1$
    298                 "A filter that limits the update to the specified types of packages in the form of a comma-separated list of " +
    299                 Arrays.toString(SdkRepoConstants.NODES) +
    300                 ". This also accepts the identifiers returned by 'list sdk --extended'.",
    301                 null);
    302 
    303         define(Mode.BOOLEAN, false,
    304                 VERB_UPDATE, OBJECT_SDK, "o", KEY_OBSOLETE,                         //$NON-NLS-1$
    305                 "Installs obsolete packages.",
    306                 false);
    307 
    308         define(Mode.BOOLEAN, false,
    309                 VERB_UPDATE, OBJECT_SDK, "n", KEY_DRY_MODE,                         //$NON-NLS-1$
    310                 "Simulates the update but does not download or install anything.",
    311                 false);
    312 
    313         // --- create project ---
    314 
    315         /* Disabled for ADT 0.9 / Cupcake SDK 1.5_r1 release. [bug #1795718].
    316            This currently does not work, the alias build rules need to be fixed.
    317 
    318         define(Mode.ENUM, true,
    319                 VERB_CREATE, OBJECT_PROJECT, "m", KEY_MODE,                         //$NON-NLS-1$
    320                 "Project mode", new String[] { ARG_ACTIVITY, ARG_ALIAS });
    321         */
    322         define(Mode.STRING, true,
    323                 VERB_CREATE, OBJECT_PROJECT,
    324                 "p", KEY_PATH,
    325                 "The new project's directory.", null);
    326         define(Mode.STRING, true,
    327                 VERB_CREATE, OBJECT_PROJECT, "t", KEY_TARGET_ID,                    //$NON-NLS-1$
    328                 "Target ID of the new project.", null);
    329         define(Mode.STRING, true,
    330                 VERB_CREATE, OBJECT_PROJECT, "k", KEY_PACKAGE,                      //$NON-NLS-1$
    331                 "Android package name for the application.", null);
    332         define(Mode.STRING, true,
    333                 VERB_CREATE, OBJECT_PROJECT, "a", KEY_ACTIVITY,                     //$NON-NLS-1$
    334                 "Name of the default Activity that is created.", null);
    335         define(Mode.STRING, false,
    336                 VERB_CREATE, OBJECT_PROJECT, "n", KEY_NAME,                         //$NON-NLS-1$
    337                 "Project name.", null);
    338 
    339         // --- create test-project ---
    340 
    341         define(Mode.STRING, true,
    342                 VERB_CREATE, OBJECT_TEST_PROJECT, "p", KEY_PATH,                    //$NON-NLS-1$
    343                 "The new project's directory.", null);
    344         define(Mode.STRING, false,
    345                 VERB_CREATE, OBJECT_TEST_PROJECT, "n", KEY_NAME,                    //$NON-NLS-1$
    346                 "Project name.", null);
    347         define(Mode.STRING, true,
    348                 VERB_CREATE, OBJECT_TEST_PROJECT, "m", KEY_MAIN_PROJECT,            //$NON-NLS-1$
    349                 "Path to directory of the app under test, relative to the test project directory.",
    350                 null);
    351 
    352         // --- create lib-project ---
    353 
    354         define(Mode.STRING, true,
    355                 VERB_CREATE, OBJECT_LIB_PROJECT, "p", KEY_PATH,                     //$NON-NLS-1$
    356                 "The new project's directory.", null);
    357         define(Mode.STRING, true,
    358                 VERB_CREATE, OBJECT_LIB_PROJECT, "t", KEY_TARGET_ID,                //$NON-NLS-1$
    359                 "Target ID of the new project.", null);
    360         define(Mode.STRING, false,
    361                 VERB_CREATE, OBJECT_LIB_PROJECT, "n", KEY_NAME,                     //$NON-NLS-1$
    362                 "Project name.", null);
    363         define(Mode.STRING, true,
    364                 VERB_CREATE, OBJECT_LIB_PROJECT, "k", KEY_PACKAGE,                  //$NON-NLS-1$
    365                 "Android package name for the library.", null);
    366 
    367         // --- update project ---
    368 
    369         define(Mode.STRING, true,
    370                 VERB_UPDATE, OBJECT_PROJECT, "p", KEY_PATH,                         //$NON-NLS-1$
    371                 "The project's directory.", null);
    372         define(Mode.STRING, false,
    373                 VERB_UPDATE, OBJECT_PROJECT, "t", KEY_TARGET_ID,                    //$NON-NLS-1$
    374                 "Target ID to set for the project.", null);
    375         define(Mode.STRING, false,
    376                 VERB_UPDATE, OBJECT_PROJECT, "n", KEY_NAME,                         //$NON-NLS-1$
    377                 "Project name.", null);
    378         define(Mode.BOOLEAN, false,
    379                 VERB_UPDATE, OBJECT_PROJECT, "s", KEY_SUBPROJECTS,                  //$NON-NLS-1$
    380                 "Also updates any projects in sub-folders, such as test projects.", false);
    381         define(Mode.STRING, false,
    382                 VERB_UPDATE, OBJECT_PROJECT, "l", KEY_LIBRARY,                      //$NON-NLS-1$
    383                 "Directory of an Android library to add, relative to this project's directory.",
    384                 null);
    385 
    386         // --- update test project ---
    387 
    388         define(Mode.STRING, true,
    389                 VERB_UPDATE, OBJECT_TEST_PROJECT, "p", KEY_PATH,                    //$NON-NLS-1$
    390                 "The project's directory.", null);
    391         define(Mode.STRING, true,
    392                 VERB_UPDATE, OBJECT_TEST_PROJECT, "m", KEY_MAIN_PROJECT,            //$NON-NLS-1$
    393                 "Directory of the app under test, relative to the test project directory.", null);
    394 
    395         // --- update lib project ---
    396 
    397         define(Mode.STRING, true,
    398                 VERB_UPDATE, OBJECT_LIB_PROJECT, "p", KEY_PATH,                     //$NON-NLS-1$
    399                 "The project's directory.", null);
    400         define(Mode.STRING, false,
    401                 VERB_UPDATE, OBJECT_LIB_PROJECT, "t", KEY_TARGET_ID,                //$NON-NLS-1$
    402                 "Target ID to set for the project.", null);
    403 
    404         // --- create identity file ---
    405 
    406         define(Mode.STRING, true,
    407                 VERB_CREATE, OBJECT_IDENTITY, "a", KEY_ACCOUNT,                      //$NON-NLS-1$
    408                 "The publisher account.", null);
    409         define(Mode.STRING, true,
    410                 VERB_CREATE, OBJECT_IDENTITY, "s", KEY_KEYSTORE,                     //$NON-NLS-1$
    411                 "The keystore path.", null);
    412         define(Mode.STRING, true,
    413                 VERB_CREATE, OBJECT_IDENTITY, "k", KEY_ALIAS,                        //$NON-NLS-1$
    414                 "The key alias.", null);
    415         define(Mode.STRING, true,
    416                 VERB_CREATE, OBJECT_IDENTITY, "p", KEY_STOREPASS,                    //$NON-NLS-1$
    417                 "The keystore password.", null);
    418         define(Mode.STRING, true,
    419                 VERB_CREATE, OBJECT_IDENTITY, "w", KEY_KEYPASS,                      //$NON-NLS-1$
    420                 "The alias password.", null);
    421 
    422     }
    423 
    424     @Override
    425     public boolean acceptLackOfVerb() {
    426         return true;
    427     }
    428 
    429     // -- some helpers for generic action flags
    430 
    431     /** Helper to retrieve the --path value. */
    432     public String getParamLocationPath() {
    433         return (String) getValue(null, null, KEY_PATH);
    434     }
    435 
    436     /**
    437      * Helper to retrieve the --target id value.
    438      * The id is a string. It can be one of:
    439      * - an integer, in which case it's the index of the target (cf "android list targets")
    440      * - a symbolic name such as android-N for platforn API N
    441      * - a symbolic add-on name such as written in the avd/*.ini files,
    442      *   e.g. "Google Inc.:Google APIs:3"
    443      */
    444     public String getParamTargetId() {
    445         return (String) getValue(null, null, KEY_TARGET_ID);
    446     }
    447 
    448     /** Helper to retrieve the --name value. */
    449     public String getParamName() {
    450         return (String) getValue(null, null, KEY_NAME);
    451     }
    452 
    453     /** Helper to retrieve the --skin value. */
    454     public String getParamSkin() {
    455         return (String) getValue(null, null, KEY_SKIN);
    456     }
    457 
    458     /** Helper to retrieve the --sdcard value. */
    459     public String getParamSdCard() {
    460         return (String) getValue(null, null, KEY_SDCARD);
    461     }
    462 
    463     /** Helper to retrieve the --force flag. */
    464     public boolean getFlagForce() {
    465         return ((Boolean) getValue(null, null, KEY_FORCE)).booleanValue();
    466     }
    467 
    468     /** Helper to retrieve the --snapshot flag. */
    469     public boolean getFlagSnapshot() {
    470         return ((Boolean) getValue(null, null, KEY_SNAPSHOT)).booleanValue();
    471     }
    472 
    473     // -- some helpers for avd action flags
    474 
    475     /** Helper to retrieve the --rename value for a move verb. */
    476     public String getParamMoveNewName() {
    477         return (String) getValue(VERB_MOVE, null, KEY_RENAME);
    478     }
    479 
    480 
    481     // -- some helpers for project action flags
    482 
    483     /** Helper to retrieve the --package value.
    484      * @param directObject the directObject of the action, either {@link #OBJECT_PROJECT}
    485      * or {@link #OBJECT_LIB_PROJECT}.
    486      */
    487     public String getParamProjectPackage(String directObject) {
    488         return ((String) getValue(null, directObject, KEY_PACKAGE));
    489     }
    490 
    491     /** Helper to retrieve the --activity for any project action. */
    492     public String getParamProjectActivity() {
    493         return ((String) getValue(null, OBJECT_PROJECT, KEY_ACTIVITY));
    494     }
    495 
    496     /** Helper to retrieve the --library value.
    497      * @param directObject the directObject of the action, either {@link #OBJECT_PROJECT}
    498      * or {@link #OBJECT_LIB_PROJECT}.
    499      */
    500     public String getParamProjectLibrary(String directObject) {
    501         return ((String) getValue(null, directObject, KEY_LIBRARY));
    502     }
    503 
    504 
    505     /** Helper to retrieve the --subprojects for any project action. */
    506     public boolean getParamSubProject() {
    507         return ((Boolean) getValue(null, OBJECT_PROJECT, KEY_SUBPROJECTS)).booleanValue();
    508     }
    509 
    510     // -- some helpers for test-project action flags
    511 
    512     /** Helper to retrieve the --main value. */
    513     public String getParamTestProjectMain() {
    514         return ((String) getValue(null, null, KEY_MAIN_PROJECT));
    515     }
    516 
    517 
    518     // -- some helpers for update sdk flags
    519 
    520     /** Helper to retrieve the --no-ui flag. */
    521     public boolean getFlagNoUI(String verb) {
    522         return ((Boolean) getValue(verb, null, KEY_NO_UI)).booleanValue();
    523     }
    524 
    525     /** Helper to retrieve the --no-https flag. */
    526     public boolean getFlagNoHttps() {
    527         return ((Boolean) getValue(null, null, KEY_NO_HTTPS)).booleanValue();
    528     }
    529 
    530     /** Helper to retrieve the --dry-mode flag. */
    531     public boolean getFlagDryMode() {
    532         return ((Boolean) getValue(null, null, KEY_DRY_MODE)).booleanValue();
    533     }
    534 
    535     /** Helper to retrieve the --obsolete flag. */
    536     public boolean getFlagObsolete() {
    537         return ((Boolean) getValue(null, null, KEY_OBSOLETE)).booleanValue();
    538     }
    539 
    540     /** Helper to retrieve the --extended flag. */
    541     public boolean getFlagExtended() {
    542         return ((Boolean) getValue(null, null, KEY_EXTENDED)).booleanValue();
    543     }
    544 
    545     /** Helper to retrieve the --filter value. */
    546     public String getParamFilter() {
    547         return ((String) getValue(null, null, KEY_FILTER));
    548     }
    549 
    550     /** Helper to retrieve the --abi value. */
    551     public String getParamAbi() {
    552         return ((String) getValue(null, null, KEY_ABI));
    553     }
    554 
    555     /** Helper to retrieve the --proxy-host value. */
    556     public String getParamProxyHost() {
    557         return ((String) getValue(null, null, KEY_PROXY_HOST));
    558     }
    559 
    560     /** Helper to retrieve the --proxy-port value. */
    561     public String getParamProxyPort() {
    562         return ((String) getValue(null, null, KEY_PROXY_PORT));
    563     }
    564 
    565     // -- some helpers for list avds and list targets flags
    566 
    567     /** Helper to retrieve the --compact value. */
    568     public boolean getFlagCompact() {
    569         return ((Boolean) getValue(null, null, KEY_COMPACT)).booleanValue();
    570     }
    571 
    572     /** Helper to retrieve the --null value. */
    573     public boolean getFlagEolNull() {
    574         return ((Boolean) getValue(null, null, KEY_EOL_NULL)).booleanValue();
    575     }
    576 }
    577