CliArgParser class

Parser for command-line arguments.

Parses arguments using the flexible buildkit/Tom CLI conventions:

  • Short options: -s, -r, -v
  • Long options: --scan, --recursive, --verbose
  • Values: -s ., --scan=., --scan .
  • Multi-value: -p pattern1 -p pattern2, --project=pattern1,pattern2
  • Commands: :command, :cleanup, :compile
  • Per-command args: :cmd --project=x (after :cmd until next :cmd)

Constructors

CliArgParser({ToolDefinition? toolDefinition, List<OptionDefinition> allowedOptions = const []})

Properties

allowedOptions → List<OptionDefinition>
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
toolDefinition → ToolDefinition?
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parse(List<String> args) → CliArgs
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

parseCommandLine(String commandLine, {CommandDefinition? commandDefinition, ToolDefinition? toolDefinition}) → CliArgs
Parse a command-line string (for REPL use).
splitCommandLine(String line) → List<String>
Split a command line string into arguments, respecting quotes.