starlined 🌟
terminal output gem with animated stars, colored messages, and progress tracking.
install
gem 'starlined'
usage
basic messages
require 'starlined'
include Starlined::Messages
info "Starting deployment"
warn "Config file missing"
error "Connection failed"
success "Build complete", 3.5 # with elapsed time
run with animation (sequentially)
runner = Starlined::Runner.new
runner.start("Installing deps", steps: 3)
runner.run("bundle install", aka: "bundler")
runner.run("npm install", aka: "npm")
runner.run("rake db:migrate", aka: "database")
runner.stop
The aka
parameter shows what's currently running in the animation.
run in parallel
runner = Starlined::Runner.new
runner.start("Running tests", steps: 3)
threads = []
threads << Thread.new { runner.run("rspec spec/models") }
threads << Thread.new { runner.run("rspec spec/controllers") }
threads << Thread.new { runner.run("rspec spec/features") }
threads.each(&:join)
runner.stop
animation manipulation/control
animation = Starlined::Animation.new("Processing", steps: 100)
animation.start
100.times do |i|
# do work
animation.increment_step
animation.add_alias("file_#{i}.txt")
sleep 0.1
animation.remove_alias("file_#{i}.txt")
end
animation.stop
custom configuration
Starlined.configure do |config|
config.verbose = true # show verbose messages
config.sleep_time = 0.5 # animation speed
config.msg_ljust = 40 # message padding
end
license
CC-NC-BY-4.0, open-sourced from okticket