From 09068f26070a3d2fac1574aa26d8104530b045fb Mon Sep 17 00:00:00 2001 From: ViViDboarder Date: Fri, 22 Nov 2013 16:38:04 -0800 Subject: [PATCH] Print target list with tables Use Thor print_table method to print into columns for a cleaner look --- lib/abusetheforce/cli.rb | 16 ++++++++++++---- lib/abusetheforce/version.rb | 3 ++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/abusetheforce/cli.rb b/lib/abusetheforce/cli.rb index afc879b..22783c3 100644 --- a/lib/abusetheforce/cli.rb +++ b/lib/abusetheforce/cli.rb @@ -35,8 +35,6 @@ module AbuseTheForce # Get path to temp project directory temp_path = File.join(Atf_Config.root_dir, TEMP_DIR) - puts "Config path #{temp_path}" - # Clear temp dir if Dir.exists? temp_path FileUtils.rm_r temp_path @@ -240,12 +238,22 @@ module AbuseTheForce desc "list", "Lists all targets" def list() - puts "Name\t\tUsername" + target_output = [] + + target_output.push ["Active", "Alias", "Username", ""] Atf_Config.targets.values.each do |target| - target.print + #target.print + + target_output.push ["#{(target.active ? ' ==> ' : ' ')}", + target.name, + target.username, + "#{(target.host.starts_with?('test') ? 'sandbox' : '')}" + ] end + print_table target_output + end # By default, display the current target diff --git a/lib/abusetheforce/version.rb b/lib/abusetheforce/version.rb index cc3b9d6..9deb888 100644 --- a/lib/abusetheforce/version.rb +++ b/lib/abusetheforce/version.rb @@ -1,3 +1,4 @@ module AbuseTheForce - VERSION = '0.1.3' + VERSION = '0.1.4' end +