Class: Pik::List

Inherits:
Command show all
Defined in:
lib/pik/commands/list_command.rb

Instance Attribute Summary collapse

Attributes inherited from Command

#config, #debug, #options, #output, #version

Instance Method Summary collapse

Methods inherited from Command

#actual_gem_home, #add_sigint_handler, aka, choose_from, #close, cmd_name, #cmd_name, #create, #current_gem_bin_path, #current_version?, #default_gem_home, #delete_old_pik_script, description, #editors, #find_config_from_path, #gem_path, #get_version, hl, inherited, #initialize, it, names, #parse_options, #pik_version, #sh, summary

Constructor Details

This class inherits a constructor from Pik::Command

Instance Attribute Details

#remoteObject (readonly)

Returns the value of attribute remote.



8
9
10
# File 'lib/pik/commands/list_command.rb', line 8

def remote
  @remote
end

#verboseObject (readonly)

Returns the value of attribute verbose.



8
9
10
# File 'lib/pik/commands/list_command.rb', line 8

def verbose
  @verbose
end

Instance Method Details

#executeObject



10
11
12
13
14
15
16
# File 'lib/pik/commands/list_command.rb', line 10

def execute 
  if remote
    remote_list
  else
    list
  end
end

#listObject



22
23
24
25
26
27
28
29
# File 'lib/pik/commands/list_command.rb', line 22

def list
  
  config.sort.each do |name, conf|
    puts layout(name, conf)
    puts conf.map{|k,v| "       %s: %s" % [k, v]} + ["\n"] if verbose
    
  end
end

#remote_listObject



18
19
20
# File 'lib/pik/commands/list_command.rb', line 18

def remote_list
  puts Implementations.list.to_yaml
end