argParser property

  1. @override
ArgParser get argParser
override

The argument parser for this command.

Options for this command should be registered with this parser (often in the constructor); they'll end up available via argResults. Subcommands should be registered with addSubcommand rather than directly on the parser.

This can be overridden to change the arguments passed to the ArgParser constructor.

Implementation

@override
ArgParser get argParser {
  return ArgParser()
    ..addOption(
      nameOption,
      abbr: 'n',
      mandatory: true,
      help: 'Name of module in snake case',
      valueHelp: 'my_cool_module',
    )
    ..addOption(
      pathOption,
      abbr: 'p',
      defaultsTo: '.',
      help: 'Path to directory where module files will be generated',
      valueHelp: 'dir1/dir2',
    )
    ..addFlag(
      isSubdirNeededFlag,
      abbr: 's',
      help: 'Should we generate subdirectory for module?',
    )
    // path to templates directory (mostly for testing purposes)
    ..addTemplatePathOption();
}