Module: Secrets::App::Commands

Defined in:
lib/secrets/app/commands.rb,
lib/secrets/app/commands/command.rb,
lib/secrets/app/commands/show_help.rb,
lib/secrets/app/commands/open_editor.rb,
lib/secrets/app/commands/generate_key.rb,
lib/secrets/app/commands/show_version.rb,
lib/secrets/app/commands/show_examples.rb,
lib/secrets/app/commands/encrypt_decrypt.rb,
lib/secrets/app/commands/delete_keychain_key.rb

Defined Under Namespace

Classes: Command, DeleteKeychainKey, EncryptDecrypt, GenerateKey, OpenEditor, ShowExamples, ShowHelp, ShowVersion

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.commandsObject

Returns the value of attribute commands.



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

def commands
  @commands
end

Class Method Details

.find_command_class(opts) ⇒ Object



13
14
15
16
17
18
# File 'lib/secrets/app/commands.rb', line 13

def find_command_class(opts)
  self.commands.each do |command_class|
    return command_class if command_class.options_satisfied_by?(opts.to_hash)
  end
  nil
end

.register(command_class) ⇒ Object



20
21
22
# File 'lib/secrets/app/commands.rb', line 20

def register(command_class)
  self.commands << command_class
end