Class: Ace::Tmux::CLI::Commands::ListPresets

Inherits:
Support::Cli::Command
  • Object
show all
Includes:
Support::Cli::Base
Defined in:
lib/ace/tmux/cli/commands/list_presets.rb

Instance Method Summary collapse

Instance Method Details

#call(type: nil, **_options) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/ace/tmux/cli/commands/list_presets.rb', line 31

def call(type: nil, **_options)
  preset_loader = Molecules::PresetLoader.new(gem_root: Tmux.gem_root)

  if type
    validate_type!(type)
    display_type(type, preset_loader.list(type))
    return
  end

  all = preset_loader.list_all
  all.each { |preset_type, presets| display_type(preset_type, presets) }
  puts "No presets found." if all.empty?
end