GooglePlayVersionCommand constructor Null safety

GooglePlayVersionCommand(
  1. {Logger? logger}
)

automatic_version_upgrader google-play-version command which gets the current version of the app from the Google Play Store.

Implementation

GooglePlayVersionCommand({
  Logger? logger,
}) : _logger = logger ?? Logger() {
  argParser
    ..addOption(
      'package-name',
      abbr: 'p',
      help: 'The package name of the app.',
      mandatory: true,
    )
    ..addOption(
      'credentials',
      defaultsTo: Platform.environment['GCLOUD_SERVICE_ACCOUNT_CREDENTIALS'],
      help: 'The credentials for the Google Cloud Service 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. ',
      },
    );
}