ShellTask class

A task that runs a series of shell commands sequentially on a set of files.

The ShellTask class extends SequentialTask and is used to execute a list of shell commands on a set of files. The commands are provided via a ShellCommands function, which takes an iterable of file paths and returns a list of shell commands to be executed.

Example usage:

ShellTask(
  name: 'Lint & Format',
  include: [Glob('**.dart')],
  exclude: [Glob('**.g.dart')],
  commands: (filePaths) => [
    'dart analyze --fatal-infos ${filePaths.join(' ')}',
    'dart format ${filePaths.join(' ')}',
  ],
);

This example creates a ShellTask named 'Lint & Format' that includes all Dart files except those ending with '.g.dart'. It runs the dart analyze and dart format commands on the included files.

Inheritance
Implementers

Constructors

ShellTask({required List<Pattern> include, required ShellCommands commands, List<Pattern> exclude = const [], String? name})

Properties

exclude List<Pattern>
The list of patterns to exclude files.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
id String
The unique identifier for the task.
finalinherited
include List<Pattern>
The list of patterns to include files.
finalinherited
name String
The name of the task.
no setteroverride
patternName String
Gets the pattern name for the task.
no setterinherited
resolvedName String
Gets the resolved name for the task.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

filterFiles(Iterable<String> filePaths) List<String>
Filters the given file paths based on the include and exclude patterns.
inherited
getSubTasks(Iterable<String> filePaths) List<HookTask>
Gets the list of sub-tasks for the given file paths.
override
label(Iterable<String> filePaths) TaskLabel
Creates a label for the task with the given file paths.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve(List<String> filePaths, int index) ResolvedHookTask
Resolves the task with the given file paths and index.
inherited
run(List<String> filePaths, {required void print(String?), required void completeTask(HookTask, int), required void startTask(HookTask)}) FutureOr<int>
Runs the task with the given file paths.
inherited
subTasks(Iterable<String> filePaths) List<HookTask>
Returns the list of sub-tasks for the given file paths.
inherited
toString() String
A string representation of this object.
inherited

Operators

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