Module: Downloads::Commands

Defined in:
lib/downloads/commands.rb,
lib/downloads/commands/ls.rb,
lib/downloads/commands/mv.rb,
lib/downloads/commands/rm.rb,
lib/downloads/commands/add.rb,
lib/downloads/commands/help.rb,
lib/downloads/commands/quit.rb,
lib/downloads/commands/sync.rb,
lib/downloads/commands/shell.rb,
lib/downloads/commands/video.rb,
lib/downloads/commands/config.rb,
lib/downloads/commands/status.rb,
lib/downloads/commands/attachments.rb

Defined Under Namespace

Classes: Add, Attachments, Base, Config, Help, Ls, Mv, Quit, Rm, Shell, Status, Sync, Video

Class Method Summary collapse

Class Method Details

.configurationObject



3
4
5
# File 'lib/downloads/commands.rb', line 3

def self.configuration
  @@configuration ||= Configuration.new
end

.lookup(argv) ⇒ Object

MAYBE we could use optparse at this top level as well, allowing for (1) overriding host & directory config and (2) faking remote interactions



20
21
22
23
# File 'lib/downloads/commands.rb', line 20

def self.lookup(argv)
  klass = registry[argv.shift] || Help
  klass.new(configuration, argv)
end

.namesObject



11
12
13
# File 'lib/downloads/commands.rb', line 11

def self.names
  registry.keys.sort
end

.objectsObject



15
16
17
# File 'lib/downloads/commands.rb', line 15

def self.objects
  registry.values.sort_by { |command| command.command_name }
end

.registryObject



7
8
9
# File 'lib/downloads/commands.rb', line 7

def self.registry
  @@registry ||= {}
end