add_pane do |pane| pane.height = 0.25 pane.width = 0.25 pane.top = 0 pane.left = 0 pane.highlight = false pane.title = "Time Update - Every Second" pane.interval = 1 pane.content do |content| date = `date` content.add_row(date) end end add_pane do |pane| pane.height = 0.25 pane.width = 0.25 pane.top = 0.25 pane.left = 0 pane.highlight = false pane.title = "Time Update - Every 5 Seconds" pane.interval = 30 pane.content do |content| date = `date` content.add_row(date) end end add_pane do |pane| pane.height = 0.25 pane.width = 0.35 pane.top = 0 pane.left = 0.25 pane.highlight = false pane.title = "Maybe Error - Every 10 Seconds" pane.interval = 10 pane.content do |content| if [true, false].sample raise "An error occured! Oh no!" end output = "[fg=cyan]No error occured[fg=white]" content.add_row(output) end end add_pane do |pane| pane.height = 0.25 pane.width = 0.3 pane.top = 0.75 pane.left = 0.0 pane.highlight = false pane.title = "Always error" pane.interval = 10 pane.content do |content| raise "An error occured! Oh no!" end end add_pane do |pane| pane.height = 0.25 pane.width = 0.35 pane.top = 0.25 pane.left = 0.25 pane.highlight = false pane.title = "Multiple Contents" pane.interval = 10 pane.content do |content| content.add_row("Line 1 of page 1", page: "Page 1") content.add_row("Line 2 of page 1", page: "Page 1") content.add_row("Line 1 of page 2", page: "Page 2") content.add_row("Line 2 of page 2", page: "Page 2") end end add_pane do |pane| pane.height = 0.25 pane.width = 0.6 pane.top = 0.5 pane.left = 0 pane.highlight = false pane.title = "Time Update - Slow Reload" pane.interval = 30 pane.show_refresh = true pane.content do |content| sleep 10 date = `date` content.add_row(date) end end require 'stringio' foo = StringIO.new $stdout = foo add_pane do |pane| pane.height = 1 pane.width = 0.4 pane.top = 0.0 pane.left = 0.6 pane.highlight = false pane.title = "STDOUT" pane.description = [ "Slowly shows stuff sent to STDOUT" ] pane.interval = 4 pane.content do |content| $stdout.string.split("\n").each do |line| content.add_row(line) end end end