printf static method

Cmd printf(
  1. String format,
  2. List<Object> args
)

A command that prints formatted text above the program output.

Similar to println but accepts format arguments.

Implementation

static Cmd printf(String format, List<Object> args) {
  // Simple string formatting
  var result = format;
  for (final arg in args) {
    result = result.replaceFirst(RegExp(r'%[sdifv]'), arg.toString());
  }
  return Cmd(() async => PrintLineMsg(result));
}