Class: Slk::Commands::Preset

Inherits:
Base
  • Object
show all
Includes:
Support::InlineImages
Defined in:
lib/slk/commands/preset.rb

Overview

Manages and applies saved status presets rubocop:disable Metrics/ClassLength

Instance Attribute Summary

Attributes inherited from Base

#options, #positional_args, #runner

Instance Method Summary collapse

Methods included from Support::InlineImages

#convert_to_png, #in_tmux?, #inline_images_supported?, #iterm2_protocol_supported?, #kitty_graphics_supported?, #png_data?, #print_inline_image, #print_inline_image_with_text, #print_iterm_image, #print_kitty_image, #print_tmux_iterm_image, #print_tmux_kitty_image, #read_image_data_for_protocol, #tmux_client_is_kitty_compatible?

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Slk::Commands::Base

Instance Method Details

#dispatch_actionObject



20
21
22
23
24
25
26
27
28
# File 'lib/slk/commands/preset.rb', line 20

def dispatch_action
  case positional_args
  in ['list' | 'ls'] | [] then list_presets
  in ['add'] then add_preset
  in ['edit', name] then edit_preset(name)
  in ['delete' | 'rm', name] then delete_preset(name)
  in [name, *] then apply_preset(name)
  end
end

#executeObject



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

def execute
  result = validate_options
  return result if result

  dispatch_action
end