Class: Shard::CLI::List

Inherits:
Object
  • Object
show all
Defined in:
lib/shard/cli/list.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.run(username) ⇒ Object

# Class Methods #

#


11
12
13
# File 'lib/shard/cli/list.rb', line 11

def self.run(username)
  new.run(username)
end

Instance Method Details

#run(username) ⇒ Object

# Instance Methods #

#


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/shard/cli/list.rb', line 21

def run(username)
  lister = Shard::Lister.new(username)

  if lister.shards.any?
    puts "Shards for Github user #{ username }:"
    puts

    lister.shard_names.each do |name|
      shard = lister.shards[name]
      puts "#{ name }:"
      puts "  Description | #{ shard.description }"
      puts "  URL         | #{ shard.url }"
      puts
    end
  else
    puts "Github user #{ username } does not have any shards."
    puts "Shards are gists that have a file named shard.rb or <foo>.shard.rb"
  end
end