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

Constant Summary collapse

SCHEDULE_USAGE =
'Usage: slk status schedule "<text>" [:emoji:] <start-end> | --start WHEN [--end WHEN]'
MISSING_RANGE =
'Missing time range. Example: slk status schedule "Vet Appt" :paw_prints: 1:30p-3:30p ' \
'(or --start/--end for a multi-day window).'

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



27
28
29
30
31
32
33
34
35
36
# File 'lib/slk/commands/status.rb', line 27

def dispatch_action
  case positional_args
  in ['schedule', *rest] then schedule_status(rest)
  in ['scheduled', *] then list_scheduled
  in ['unschedule', *rest] then unschedule_status(rest)
  in ['clear', *] then clear_status
  in [text, *rest] then set_status(text, rest)
  in [] then get_status
  end
end

#executeObject



17
18
19
20
21
22
23
24
25
# File 'lib/slk/commands/status.rb', line 17

def execute
  result = validate_options
  return result if result

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