ToolDefinition class

Definition of a CLI tool for buildkit and similar applications.

Provides metadata for automatic help generation, argument parsing, and traversal configuration.

Available extensions

Constructors

ToolDefinition({required String name, required String description, String version = '1.0.0', ToolMode mode = ToolMode.multiCommand, NavigationFeatures features = const NavigationFeatures(), List<OptionDefinition> globalOptions = const [], List<CommandDefinition> commands = const [], String? defaultCommand, String? helpFooter, Set<Type>? requiredNatures, Set<Type> worksWithNatures = const {}})
const

Properties

allGlobalOptions List<OptionDefinition>
Get all global options including feature-based options.
no setter
commands List<CommandDefinition>
Available commands (empty for single-command tools).
final
defaultCommand String?
Default command when none specified (multi-command tools).
final
description String
Human-readable description for help text.
final
features NavigationFeatures
Navigation features supported by this tool.
final
globalOptions List<OptionDefinition>
Tool-level options (applied before command).
final
hashCode int
The hash code for this object.
no setterinherited
helpFooter String?
Footer text for help output.
final
mode ToolMode
Tool mode (multi-command, single-command, hybrid).
final
name String
Tool name (e.g., 'buildkit', 'ws_tools').
final
requiredNatures Set<Type>?
Nature types that ALL must be present on a folder for the tool to run.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
version String
Version string (e.g., '2.0.0').
final
visibleCommands List<CommandDefinition>
Get all visible commands (not hidden).
no setter
worksWithNatures Set<Type>
Nature types where at least ONE must be present on a folder.
final

Methods

findCommand(String nameOrAlias) CommandDefinition?
Find command by name, alias, or unambiguous prefix.
findCommandsWithPrefix(String prefix) List<CommandDefinition>
Find all commands matching a prefix.
generateCompletion(ShellType shell) String

Available on ToolDefinition, provided by the ToolDefinitionCompletion extension

Generate completion script for the specified shell.
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