CommandDefinition class
Definition of a command within a multi-command tool.
Used to declare commands for tools like buildkit, enabling automatic help generation, nature-based filtering, and traversal configuration.
Constructors
-
CommandDefinition({required String name, required String description, List<
String> aliases = const [], List<OptionDefinition> options = const [], Set<Type> ? requiredNatures, Set<Type> worksWithNatures = const {}, bool supportsProjectTraversal = true, bool supportsGitTraversal = false, bool requiresGitTraversal = false, GitTraversalOrder? defaultGitOrder, bool supportsPerCommandFilter = false, bool requiresTraversal = true, List<String> examples = const [], bool canRunStandalone = false, }) -
const
Properties
-
aliases
→ List<
String> -
Alternative names for the command (e.g., 'ls' for 'list').
final
-
allOptions
→ List<
OptionDefinition> -
Get all options including traversal options if supported.
no setter
- canRunStandalone → bool
-
Whether this command can run as a standalone binary.
final
- defaultGitOrder → GitTraversalOrder?
-
Default git traversal order when command supports git traversal.
null means user must explicitly specify.
final
- description → String
-
Human-readable description for help text.
final
-
examples
→ List<
String> -
Usage examples for help text.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
Whether command is hidden from help.
final
- name → String
-
Command name (without : prefix, e.g., 'cleanup', 'compile').
final
-
options
→ List<
OptionDefinition> -
Command-specific options.
final
-
requiredNatures
→ Set<
Type> ? -
Folder MUST have ALL of these natures to run this command.
null means command can run on any folder.
final
- requiresGitTraversal → bool
-
Whether command requires git traversal mode.
When true, errors if user doesn't specify -i or -o.
final
- requiresTraversal → bool
-
Whether command requires workspace traversal to run.
false for commands like --help, --version.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- supportsGitTraversal → bool
-
Whether command supports git traversal (--modules, --skip-modules, etc.).
When true, allows git traversal if user specifies -i or -o.
When false, errors if user attempts git traversal.
final
- supportsPerCommandFilter → bool
-
Whether command supports per-command --project/--exclude filters.
final
- supportsProjectTraversal → bool
-
Whether command supports project traversal (--project, --exclude-projects, etc.).
final
- usage → String
-
Format for help text (e.g., ':cleanup, :clean').
no setter
-
worksWithNatures
→ Set<
Type> -
Natures this command can meaningfully work with.
Used for documentation and filtering guidance.
final
Methods
-
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.
inherited