Beautiful UI for showing tasks running on the command line.
MIT License
Beautiful UI for showing tasks running on the command line.
Instead of just logging long running tasks to the console, give your users a simple status dashboard.
Add this to your application's shard.yml
:
dependencies:
griffith:
github: gtramontina/griffith.cr
require "griffith"
Griffith.config do |c|
c.prefix = "[my-app] " # Default: ""
c.done_message = "OK".colorize(:green) # Default: "✓ Done".colorize(:green)
c.fail_message = "NOK".colorize(:red) # Default: "✗ Failed".colorize(:red)
c.running_message = "downloading…" # Default: "…".colorize(:yellow)
c.reporter = MyCustomReporter.new # Default: ConsoleReporter.new
end
# Add a task to display
task = Griffith.create_task("Task description")
# While working on the task, update the status
task.running("some comment")
# Optionally give details
task.details("#{percent}%")
# Chain commands
task.status_message("Downloading…")
.details("#{percent}%")
# When complete
task.done("Finished!")
# Or if it failed
task.fail("Oops")
[Test Runner] Running tests on Safari Running Now 50% CSS3 Tests
↑ prefix ↑ description (column width of 50 chars) ↑ status ↑ details
This shard was totally inspired by @dylang's observatory, hence the name and README similarity! Thank you, @dylang! 🍻😄
ConsoleReporter
and override #render(task)
in order to change the format.