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
// Trailing options stay enabled so `distribute ai "..." -p auto` works — the
// natural way to write it. A prompt that genuinely starts with a dash can be
// separated with `--`.
ArgParser get argParser => ArgParser(allowTrailingOptions: true)
  ..addOption(
    'config',
    abbr: 'c',
    help: 'Path to the configuration file.',
    defaultsTo: 'distribution.yaml',
  )
  ..addFlag(
    'setup',
    negatable: false,
    defaultsTo: false,
    help: 'Run the interactive setup wizard instead of asking a question.',
  )
  ..addOption(
    'ai-provider',
    help: 'Override the provider for this run (openai, anthropic).',
  )
  ..addOption('ai-url', help: 'Override the endpoint base URL for this run.')
  ..addOption('ai-key', help: 'Override the API key for this run.')
  ..addOption('ai-model', help: 'Override the model for this run.')
  ..addOption(
    'permission',
    abbr: 'p',
    allowed: ['manual', 'auto', 'plan'],
    help: 'Override how much the assistant may do on its own.',
    allowedHelp: {
      'manual': 'Show the command and ask before running it.',
      'auto': 'Run the chosen command without asking.',
      'plan': 'Print the command; never execute.',
    },
  );