I18NCommand constructor

I18NCommand()

The command used to run the I18NGenerator.

Implementation

I18NCommand() : super('./i18n.g.dart') {
  argParser
    ..addOption(
      'encoding',
      help: 'The encoding used for reading the `.json` and `.yaml` files. '
          'Defaults to `utf-8`.',
    )
    ..addOption(
      'base-name',
      abbr: 'n',
      help: 'The base name of the generated class. Defaults to `I18N`.',
    )
    ..addFlag(
      'convert',
      abbr: 'c',
      help: 'If the i18n names should be converted to camel case. Disabling '
          'this option will prevent any changes to be made to the i18n '
          'names. Be certain to pass valid Dart names or the generation will '
          'be likely to fail. Defaults to `true`.',
      defaultsTo: null,
    )
    ..addFlag(
      'only-language-code',
      help: 'Ensure that locales should only use their language codes. '
          'Defaults to `true`.',
      defaultsTo: null,
    )
    ..addOption(
      'base-class-name',
      abbr: 'b',
      help: 'The base name of the base I18N class. Defaults to ``.',
    )
    ..addOption(
      'enum-class-name',
      abbr: 'u',
      help: 'The name of the I18N enum class. Defaults to `I18NLocale`.',
    )
    ..addFlag(
      'serialize',
      help: 'If the generated classes should be serialized using `fromMap`. '
          'Defaults to `false`.',
      defaultsTo: null,
    )
    ..addFlag(
      'use-flutter',
      help: 'If the generated results are intended to be used with Flutter. '
          "Thus, whether Localizations class and it's Localizations Delegate "
          'should be generated. Defaults to `true`.',
      defaultsTo: null,
    )
    ..addOption(
      'localizations-class-name',
      help: 'The name of the I18N Localizations class implementation. '
          'Only used if `use-flutter` is true. '
          'Defaults to `I18NLocalizations`.',
    )
    ..addOption(
      'delegate-class-name',
      help: 'The name of the Localizations Delegate class implementation. '
          'Only used if `use-flutter` is true. Defaults to `I18NDelegate`.',
    )
    ..addOption(
      'delegate-fallback-locale',
      help: 'The locale that will be used as a fallback in Localizations '
          'Delegate. Should be the exact match of one of the generated '
          'locales. Only used if `use_flutter` is true. '
          'Defaults to the first locale generated.',
    )
    ..addMultiOption(
      'imports',
      abbr: 'f',
      help: 'The imports to be used in generated file. '
          'Defaults to import `package:meta/meta.dart`.',
      defaultsTo: <String>[null.toString()],
    );
}