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',
      help: 'Name of widget model module in snake case',
      valueHelp: 'my_cool_module',
      mandatory: true,
    )
    ..addOption(
      pathOption,
      abbr: 'p',
      defaultsTo: '.',
      help: 'Path to directory where the test will be generated (dummy mode)',
      valueHelp: 'dir1/dir2',
    )
    ..addFlag(
      smartFlag,
      abbr: 's',
      help: 'Smart mode flag: --path is path to project root '
          'and --name is source file path/name.',
    )
    // path to templates directory (mostly for testing purposes)
    ..addTemplatePathOption();
}