From 298a020e351e952ef94eb4be71ec57b60c5a5c39 Mon Sep 17 00:00:00 2001 From: nishiki Date: Sat, 17 Jan 2015 00:12:01 +0100 Subject: [PATCH] add color when display an item --- lib/UI/Cli.rb | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/lib/UI/Cli.rb b/lib/UI/Cli.rb index b1b4cda..95f6f5f 100644 --- a/lib/UI/Cli.rb +++ b/lib/UI/Cli.rb @@ -197,19 +197,27 @@ class Cli # Display an item in the default format # @args: item -> an array with the item information def display_item(item) - puts '--------------------' - puts "Id: #{item['id']}" - puts "#{I18n.t('display.name')}: #{item['name']}" - puts "#{I18n.t('display.group')}: #{item['group']}" - puts "#{I18n.t('display.server')}: #{item['host']}" - puts "#{I18n.t('display.protocol')}: #{item['protocol']}" - puts "#{I18n.t('display.login')}: #{item['login']}" - puts "#{I18n.t('display.password')}: #{item['password']}" - puts "#{I18n.t('display.port')}: #{item['port']}" - puts "#{I18n.t('display.comment')}: #{item['comment']}" + puts '--------------------'.cyan + print 'Id: '.cyan + puts item['id'] + print "#{I18n.t('display.name')}: ".cyan + puts item['name'] + print "#{I18n.t('display.group')}: ".cyan + puts item['group'] + print "#{I18n.t('display.server')}: ".cyan + puts item['host'] + print "#{I18n.t('display.protocol')}: ".cyan + puts item['protocol'] + print "#{I18n.t('display.login')}: ".cyan + puts item['login'] + print "#{I18n.t('display.password')}: ".cyan + puts item['password'] + print "#{I18n.t('display.port')}: ".cyan + puts item['port'] + print "#{I18n.t('display.comment')}: ".cyan + puts item['comment'] end - # Form to add a new item def add row = []