Project

bogo-ui

0.02
Low commit activity in last 3 years
No release in over a year
UI Helper libraries
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 5.5
~> 13.0

Runtime

 Project Readme

Bogo UI

Simple CLI output helpers.

Bogo::Ui

Output formatted information to the CLI.

require 'bogo/ui'

ui = Bogo::Ui.new(
  app_name: 'TestApp'
)

ui.info 'This is information'
ui.warn 'This is a warning'
ui.error 'This is an error'

ui.info "This is information with #{ui.color('color', :bold, :green)}"

result = ui.ask('Type a word')
ui.info "You provided: #{result}"

Bogo::Ui::Table

This is a table helper. Under the hood it uses the Command Line Reporter with a few modifications. Direct usage:

require 'bogo/ui'

ui = Bogo::Ui.new(app_name: 'TestApp')
Bogo::Ui::Table.new(ui) do
  table do
    row do
      column 'Name'
      column 'Age'
    end
    row do
      column 'me'
      column '100'
    end
  end
end.display

This helper allows for appending data to an existing table. Useful for when polling for updates and wanting to keep the existing table structure:

require 'bogo/ui'

ui = Bogo::Ui.new(app_name: 'TestApp')
tbl = Bogo::Ui::Table.new(ui) do
  table do
    row do
      column 'Name'
      column 'Age'
    end
    row do
      column 'me'
      column '100'
    end
  end
end

tbl.display

tbl.update do
  row do
    column 'you'
    column '50'
  end
end

tbl.display

Info