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 {
  final argParser = super.argParser;
  if (!argParser.hasOptionWithKey('base-ref')) {
    argParser.addOption(
      'base-ref',
      abbr: 'b',
      help: 'The previous version to compare against.'
          'Defaults to previous version from git history.',
    );
  }
  if (!argParser.hasOptionWithKey('new-ref')) {
    argParser.addOption(
      'new-ref',
      abbr: 'n',
      defaultsTo: 'HEAD',
      help: "The new version to compare against defaulting to HEAD",
    );
  }
  return argParser;
}