SwitchInfo class
Metadata for a single switch option within a command.
Example YAML:
deploy:
switch:
staging: "-s, --stg" ## Deploy to staging
script: echo "Deploying to staging"
This creates a SwitchInfo with:
- name: "staging"
- flags: "-s, --stg"
- description: "Deploy to staging"
- command: Command with the script
Constructors
- SwitchInfo({required String name, required Command command, String? flags, String? description})
-
const
Properties
-
aliases
→ List<
String> -
All aliases for this switch (name + parsed flags)
For "staging" with flags "-s, --stg", returns:
"staging", "-s", "--stg"no setter - command → Command
-
The command to execute when this switch is selected
final
- description → String?
-
Optional description for help text and picker menu
final
- flags → String?
-
Optional flags/aliases (e.g., "-s, --stg")
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- name → String
-
The switch name (e.g., "staging", "ios", "unit")
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
matches(
String arg) → bool - Check if this switch matches the given argument Matches by name or any flag alias
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override