updateStatus method
- String? message,
- TaskStatus? status,
- String? detail,
- bool clear = false,
- bool refresh = true,
Updates the current status message.
This method is used by Hooks to keep the user informed about what is currently happening, that is, which files and tasks are currently being processed. It also serves as a headline/barrier between "normal" log messages, so they can be easily grouped and mapped to a certain task/file.
The current status message is replaced with a new one. If there is no status message yet, it is created.
The message
parameter provides the primary message that should be
displayed to the user. status
is converted to a symbol, emoji, letter or
similar, that is shown before the message to indicate in which status the
current task is. With detail
, you can add a small suffix message to the
status, that gives the user a more detailed hint on what is happening.
Unless clear
is specified, old values are kept and only replaced by
explicit parameters. If set to true, the old status will be completely
cleared before applying new values.
Implementation
@override
void updateStatus({
String? message,
TaskStatus? status,
String? detail,
bool clear = false,
bool refresh = true,
}) {
_statusMessage = message ?? (clear ? '' : _statusMessage);
_statusState = status ?? (clear ? null : _statusState);
_statusDetail = detail ?? (clear ? null : _statusDetail);
if (!refresh) {
return;
}
_freshStatus = true;
Console.overwriteLine('');
if (_statusState != null) {
Console.write('${_statusState!.icon} ');
}
Console.write(_statusMessage);
if (_statusDetail != null) {
try {
Console.setItalic(true);
Console.write(' $_statusDetail');
} finally {
Console.setItalic(false);
}
}
}