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