Class: Slk::Commands::Status

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

Overview

Gets or sets user status text and emoji 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



23
24
25
26
27
28
29
# File 'lib/slk/commands/status.rb', line 23

def dispatch_action
  case positional_args
  in ['clear', *] then clear_status
  in [text, *rest] then set_status(text, rest)
  in [] then get_status
  end
end

#executeObject



13
14
15
16
17
18
19
20
21
# File 'lib/slk/commands/status.rb', line 13

def execute
  result = validate_options
  return result if result

  dispatch_action
rescue ApiError => e
  error("Failed: #{e.message}")
  1
end