Class: Ankit::ListCommand

Inherits:
Command
  • Object
show all
Includes:
CardNaming
Defined in:
lib/ankit/list_command.rb

Constant Summary

Constants inherited from Command

Command::COMMANDS

Instance Attribute Summary

Attributes inherited from Command

#args, #options, #runtime

Instance Method Summary collapse

Methods included from CardNaming

#card_wildcard_for, #to_card_name, #to_card_path

Methods inherited from Command

available, by_name, command_name, define_options, #initialize, option_spec

Constructor Details

This class inherits a constructor from Ankit::Command

Instance Method Details

#each_card(&block) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/ankit/list_command.rb', line 14

def each_card(&block)
  runtime.config.card_search_paths.each do |p|
    Dir.glob(card_wildcard_for(p)).each do |f|
      block.call(f)
    end
  end
end

#each_card_name(&block) ⇒ Object



22
23
24
# File 'lib/ankit/list_command.rb', line 22

def each_card_name(&block)
  each_card { |path| block.call(to_card_name(path)) }
end

#executeObject



10
11
12
# File 'lib/ankit/list_command.rb', line 10

def execute()
  each_card { |f| runtime.stdout.print("#{f}\n") }
end