Class: Yap::Cli::Commands::Addon::List

Inherits:
Object
  • Object
show all
Defined in:
lib/yap/cli/commands/addon/list.rb

Instance Method Summary collapse

Instance Method Details

#filter=(filter_kind) ⇒ Object



5
6
7
# File 'lib/yap/cli/commands/addon/list.rb', line 5

def filter=(filter_kind)
  @filter = filter_kind
end

#processObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/yap/cli/commands/addon/list.rb', line 9

def process
  configuration = Yap.configuration

  addon_refs = ::Yap::Addon::Path.
    find_for_configuration(configuration)
  if addon_refs.empty?
    puts "      |No addons found searching paths:\n      |  - \#{configuration.addon_paths.join(\"\\n  -\")}\n    MSG\n  elsif @filter == :enabled\n    addon_refs.select(&:enabled?).each do |addon_ref|\n      puts \"\#{addon_ref.name}\"\n    end\n  elsif @filter == :disabled\n    addon_refs.select(&:disabled?).each do |addon_ref|\n      puts \"\#{addon_ref.name}\"\n    end\n  else\n    addon_refs.each do |addon_ref|\n      enabled_or_disabled = addon_ref.enabled? ? 'enabled' : 'disabled'\n      puts \"\#{addon_ref.name} (\#{enabled_or_disabled})\"\n    end\n  end\nend\n".strip_heredoc