Class: Gizzard::LinksCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/gizzard/commands.rb

Instance Attribute Summary

Attributes inherited from Command

#argv, #buffer, #command_options, #global_options, #job_injector, #manager

Instance Method Summary collapse

Methods inherited from Command

classify, #confirm!, #get_base_name, #help!, #initialize, make_job_injector, make_manager, #output, #require_tables, #require_template_options, run

Constructor Details

This class inherits a constructor from Gizzard::Command

Instance Method Details

#runObject



316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/gizzard/commands.rb', line 316

def run
  shard_ids = @argv
  shard_ids.each do |shard_id_text|
    shard_id = ShardId.parse(shard_id_text)
    next if !shard_id
    unless command_options.down
      manager.list_upward_links(shard_id).each do |link_info|
        output command_options.ids ? link_info.up_id.to_unix : link_info.to_unix
      end
    end
    unless command_options.up
      manager.list_downward_links(shard_id).each do |link_info|
        output command_options.ids ? link_info.down_id.to_unix : link_info.to_unix
      end
    end
  end
end