AppStoreVersionCommand constructor Null safety

AppStoreVersionCommand(
  1. {Logger? logger}
)

automatic_version_upgrader app-store-version command which gets the current version of the app from App Store Connect.

Implementation

AppStoreVersionCommand({
  Logger? logger,
}) : _logger = logger ?? Logger() {
  argParser
    ..addOption(
      'app-id',
      help: 'The identifier of the app.',
      mandatory: true,
    )
    ..addOption(
      'private-key',
      defaultsTo: Platform.environment['APP_STORE_CONNECT_PRIVATE_KEY'],
      help: 'The private key from the App Store Connect account.',
    )
    ..addOption(
      'key-id',
      defaultsTo: Platform.environment['APP_STORE_CONNECT_KEY_IDENTIFIER'],
      help: 'The key id from the App Store Connect account.',
    )
    ..addOption(
      'issuer-id',
      defaultsTo: Platform.environment['APP_STORE_CONNECT_ISSUER_ID'],
      help: "The private key's issuer id from the App Store Connect account.",
    )
    ..addOption(
      'next',
      allowed: ['major', 'minor', 'patch', 'breaking', 'build'],
      allowedHelp: {
        'major': 'Gets the next major version number that follows this one. '
            'If this version is a pre-release of a major version '
            'release (i.e. the minor and patch versions are zero), then it '
            'just strips the pre-release suffix. Otherwise, it increments '
            'the major version and resets the minor and patch.',
        'minor': 'Gets the next minor version number that follows this one. '
            'If this version is a pre-release of a minor version '
            'release (i.e. the patch version is zero), then it just strips '
            'the pre-release suffix. Otherwise, it increments the minor '
            'version and resets the patch. ',
        'patch': 'Gets the next patch version number that follows this one. '
            'If this version is a pre-release, then it just strips the '
            'pre-release suffix. Otherwise, it increments the patch version.',
        'breaking': 'Gets the next breaking version number that follows '
            "this one. Increments [major] if it's greater than zero, "
            'otherwise [minor], resets subsequent digits to zero, '
            'and strips any [preRelease] or [build] suffix.',
        'build': 'Gets the next build number that follows this one. '
            'If this version is a pre-release, then it just strips the '
            'pre-release suffix. Otherwise, it increments the build. '
            'Note: If the latest version is actually bigger than the latest '
            'build, then the build number is reset to zero and the version '
            'grabbed will be the next patch to the latest version.',
      },
      help: 'Updates the version number.',
      defaultsTo: 'build',
      valueHelp: 'major|minor|patch|breaking|build',
    )
    ..addOption(
      'upgrade-mode',
      abbr: 'u',
      valueHelp: 'always|never|outdated',
      defaultsTo: 'never',
      help: "Updates the version in your app's pubspec.yaml file.",
      allowedHelp: {
        'always': "Updates the app's version to the oldest plus a patch.",
        'never': "Doesn't update the version.",
        'outdated': "Updates the app's version if there's a "
            'newer one available. Otherwise, does nothing. ',
      },
    );
}