Arguments.fromArgParser constructor

Arguments.fromArgParser(
  1. ArgResults results,
  2. ArgResults? globalResults
)

Creates Arguments instance from command-line arguments.

Parses command-line arguments and optional global results to create a fully configured Xcrun Arguments instance. Handles type conversion and validation for all Xcrun-specific parameters.

Parameters:

  • results - Parsed command-line arguments
  • globalResults - Optional global command arguments

Returns configured Arguments instance with parsed values. Uses first rest argument as file path if available, otherwise defaults to standard iOS distribution output directory.

Implementation

factory Arguments.fromArgParser(
  ArgResults results,
  ArgResults? globalResults,
) =>
    Arguments(
      Variables.fromSystem(globalResults),
      // `--file-path` was declared and even marked mandatory, but never read:
      // the publisher uploaded whatever happened to be in the default output
      // directory, which is how a stale IPA reaches App Store Connect.
      filePath: (results['file-path'] as String?) ??
          results.rest.firstOrNull ??
          Files.iosDistributionOutputDir.path,
      username: results['username'] as String?,
      password: results['password'] as String?,
      apiKey: results['api-key'] as String?,
      apiIssuer: results['api-issuer'] as String?,
      appleId: results['apple-id'] as String?,
      bundleVersion: results['bundle-version'] as String?,
      bundleShortVersionString:
          results['bundle-short-version-string'] as String?,
      ascPublicId: results['asc-public-id'] as String?,
      type: results['type'] as String?,
      validateApp: results['validate-app'] as bool? ?? false,
      uploadPackage: results['upload-package'] as String?,
      bundleId: results['bundle-id'] as String?,
      productId: results['product-id'] as String?,
      sku: results['sku'] as String?,
      outputFormat: results['output-format'] as String?,
    );