lib/arql/commands/info.rb in arql-0.1.22 vs lib/arql/commands/info.rb in arql-0.1.23

- old
+ new

@@ -1,12 +1,16 @@ +require 'rainbow' + module Arql::Commands module Info class << self def db_info <<~EOF Database Connection Information: + + Active: #{color_boolean(ActiveRecord::Base.connection.active?)} Host: #{Arql::App.config[:host]} Port: #{Arql::App.config[:port]} Username: #{Arql::App.config[:username]} Password: #{(Arql::App.config[:password] || '').gsub(/./, '*')} Database: #{Arql::App.config[:database]} @@ -18,15 +22,26 @@ def ssh_info <<~EOF SSH Connection Information: + + Active: #{color_boolean(Arql::SSHProxy.active?)} Host: #{Arql::App.config[:ssh][:host]} Port: #{Arql::App.config[:ssh][:port]} Username: #{Arql::App.config[:ssh][:user]} Password: #{(Arql::App.config[:ssh][:password] || '').gsub(/./, '*')} - Local Port: #{Arql::App.local_ssh_proxy_port} + Local Port: #{Arql::SSHProxy.local_ssh_proxy_port} EOF + end + + private + def color_boolean(bool) + if bool + Rainbow('TRUE').green + else + Rainbow('FALSE').red + end end end Pry.commands.block_command 'info' do puts Info::db_info