countdownTimer static method

String countdownTimer(
  1. String message,
  2. int timeout, {
  3. String? postMessage,
})

Implementation

static String countdownTimer(final String message, final int timeout,
    {final String? postMessage}) {
  // TODO: Finish implementation
  return """
  printf "\\n%s" "$message";
  for ((i = $timeout - 1; i >= 0; i = i - 1)); do
    printf "\\33[0;31m %03ds\b\b\b\b\b\\033[0m" "\$i"
    sleep 1s
  done
  printf "\\n"
  ${postMessage != null ? "printf \"$postMessage\"" : ""}
  printf "\\n"
  """;
  // return """
  //   printf /"%s/" /"$message/"
  //   for ((i = /\$$timeout - 1; i >= 0; i = i - 1)); do
  //     printf " %s%03ds\b\b\b\b\b\$${ShellColors.NC}" "${ShellColors.BRED}" "\$i"
  //     sleep 1s
  //   done
  // """;
}