GenerateCommand constructor

GenerateCommand({
  1. HookRunner? hookRunner,
  2. String? workingDirectory,
})

Implementation

GenerateCommand({HookRunner? hookRunner, String? workingDirectory})
  : _hookRunner =
        hookRunner ?? HookRunner(workingDirectory: workingDirectory),
    _workingDirectory = workingDirectory {
  argParser.addFlag(
    'force',
    abbr: 'f',
    help: 'Overwrite existing files.',
    defaultsTo: false,
  );
  argParser.addFlag(
    'dry-run',
    abbr: 'n',
    help: 'Print planned actions without writing any files.',
    defaultsTo: false,
    negatable: false,
  );
  argParser.addFlag(
    'tests',
    help: 'Generate unit/widget test stubs alongside the component.',
    defaultsTo: true,
  );
  argParser.addFlag(
    'hooks',
    help: 'Run before/after generate hooks from rekeens.yaml.',
    defaultsTo: true,
  );
  argParser.addOption(
    'base-url',
    help:
        'Base URL for datasource templates (e.g. https://api.example.com). '
        'Falls back to rekeens.yaml `defaults.base-url`.',
  );
  argParser.addMultiOption(
    'add-field',
    help:
        'Update an existing model by adding a field (name:type). '
        'Repeatable, combinable with --remove-field.',
  );
  argParser.addMultiOption(
    'remove-field',
    help:
        'Update an existing model by removing a field (name). '
        'Repeatable, combinable with --add-field.',
  );
}