Skip to content
Browse files

pik list shows platform, list strings is simpler

  • Loading branch information...
1 parent ea6967f commit cab6c4a01e3a52401d4fdbdbd481b6e14e4c2973 @vertiginous committed Jan 25, 2011
Showing with 15 additions and 12 deletions.
  1. +4 −3 lib/pik/commands/add_command.rb
  2. +11 −9 lib/pik/commands/list_command.rb
View
7 lib/pik/commands/add_command.rb
@@ -30,9 +30,10 @@ def add(path)
Log.info "Adding: #{name}\n Located at: #{path}\n"
- config[name] = {}
- config[name][:path] = path
- config[name][:version] = version.full_version
+ config[name] = {}
+ config[name][:path] = path
+ config[name][:version] = version.full_version
+ config[name][:platform] = version.platform
end
else
puts "Couldn't find a Ruby version at #{path}"
View
20 lib/pik/commands/list_command.rb
@@ -14,11 +14,12 @@ def execute
when 'default'
default_string? ? default_list(:strings) : default_list
when 'strings'
- list(:string)
+ strings_list
else
if remote
remote_list
else
+ puts "\npik rubies\n\n"
list
end
end
@@ -44,14 +45,20 @@ def default_list(type=:simple)
puts
end
end
+
+ def strings_list
+ config.sort.each do |name,conf|
+ puts name
+ end
+ end
def default_string?
@args[1] == 'string'
end
- def list(type=:simple)
+ def list
config.sort.each do |name, conf|
- name = VersionPattern.full(name) if type == :simple
+ name = VersionPattern.full(name)
puts layout(name, conf)
puts conf.map{|k,v| " %s: %s" % [k, v]} + ["\n"] if verbose
end
@@ -60,13 +67,8 @@ def list(type=:simple)
private
def layout(name, conf)
+ name = "#{name} [ #{conf[:platform]} ]"
name = current?(conf) ? "=> #{name}" : " #{name}"
- if name.length > columns
- remainder = -(name.length - columns + 5)
- "#{name[0,columns-5]}...#{" ...%s" % name[remainder..-1] if verbose}"
- else
- name
- end
end
def current?(conf)

0 comments on commit cab6c4a

Please sign in to comment.
Something went wrong with that request. Please try again.