griffith

Beautiful UI for showing tasks running on the command line
1.0.0 Latest release released

griffith.cr travis build

Beautiful UI for showing tasks running on the command line.

Purpose

Instead of just logging long running tasks to the console, give your users a simple status dashboard.

griffith

Installation

Add this to your application's shard.yml:

dependencies:
  griffith:
    github: gtramontina/griffith.cr

Usage

require "griffith"

Config

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

Tasking out

# 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")

Terminology

[Test Runner] Running tests on Safari                            Running Now  50%  CSS3 Tests
↑ prefix      ↑ description (column width of 50 chars)           ↑ status     ↑ details

Contributing

  1. Fork it ( https://github.com/gtramontina/griffith.cr/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Acknowledgements

This shard was totally inspired by @dylang's observatory, hence the name and README similarity! Thank you, @dylang! :beers::smile:

TODO

  • [ ] Make the reporter format more flexible. Meanwhile you have to extend ConsoleReporter and override #render(task) in order to change the format.
griffith:
  github: gtramontina/griffith.cr
  version: ~> 1.0.0
License MIT
Crystal none

Authors

Dependencies 1

  • ansi-escapes 1.0.0
    {'github' => 'gtramontina/ansi-escapes.cr', 'version' => '1.0.0'}

Development Dependencies 3

  • ameba 0.8.0
    {'github' => 'veelenga/ameba', 'version' => '0.8.0'}
  • faker 0.3.0
    {'github' => 'askn/faker', 'version' => '0.3.0'}
  • spinner-frames 1.0.0
    {'github' => 'gtramontina/spinner-frames.cr', 'version' => '1.0.0'}

Dependents 1

Last synced .
search fire star recently