ModelsCommand constructor

ModelsCommand()

The command used to run the ModelsGenerator.

Implementation

ModelsCommand() : super('./models.g.dart') {
  argParser
    ..addOption(
      'encoding',
      help: 'The encoding used for reading the `.json` and `.yaml` files. '
          'Defaults to `utf-8`.',
    )
    ..addFlag(
      'convert-class-names',
      help: 'If the class names should be converted to camel case. Disabling '
          'this option will prevent any changes to be made to the class '
          'names. Be certain to pass valid Dart names or the generation will '
          'be likely to fail. Defaults to `true`.',
      defaultsTo: null,
    )
    ..addFlag(
      'convert-field-names',
      help: 'If the field names should be converted to camel case. Disabling '
          'this option will prevent any changes to be made to the field '
          'names. Be certain to pass valid Dart names or the generation will '
          'be likely to fail. Defaults to `true`.',
      defaultsTo: null,
    )
    ..addFlag(
      'convert-instance-names',
      help: 'If the instance names should be converted to camel case. '
          'Disabling this option will prevent any changes to be made to the '
          'instance names. Be certain to pass valid Dart names or the '
          'generation will be likely to fail. Defaults to `true`.',
      defaultsTo: null,
    )
    ..addFlag(
      'assign-field-types',
      help: 'If the unknown field types should be resolved from default '
          'values. Defaults to `true`.',
      defaultsTo: null,
    )
    ..addFlag(
      'include-null-fields',
      help: 'If the fields with null values should be added in `toMap`. '
          'Defaults to `true`.',
      defaultsTo: null,
    )
    ..addMultiOption(
      'imports',
      abbr: 'f',
      help: 'The imports to be used in generated files. '
          'By default, imports '
          '`package:json_converters_lite/json_converters_lite.dart`.',
      defaultsTo: <String>[null.toString()],
    );
}