CliCommand class abstract base

Base class for all CLI commands in the utility package.

This class provides common functionality for:

  • Running commands with progress tracking
  • Error handling during command execution
  • Consistent logging and user feedback

Extend this class to create specific command implementations:

class MyCommand extends CliCommand {
  @override
  Future<void> run(HookContext context) async {
    await trackOperation(
      context,
      startMessage: 'Starting operation',
      endMessage: 'Operation complete',
      operation: () => yourOperation(),
    );
  }
}
Implementers

Constructors

CliCommand.new()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
run(HookContext context) Future<void>
Run the command with the given HookContext
toString() String
A string representation of this object.
inherited
trackOperation(HookContext context, {required String startMessage, required String endMessage, required Future<void> operation()}) Future<void>
Track an operation with progress indicator

Operators

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