Class: Slk::Commands::Search

Inherits:
Base
  • Object
show all
Defined in:
lib/slk/commands/search.rb

Overview

Searches messages across channels and DMs Note: Requires user tokens (xoxc/xoxs), NOT bot tokens (xoxb) rubocop:disable Metrics/ClassLength

Instance Attribute Summary

Attributes inherited from Base

#options, #positional_args, #runner

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

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

Instance Method Details

#executeObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/slk/commands/search.rb', line 11

def execute
  result = validate_options
  return result if result

  query = positional_args.first
  return missing_query_error unless query

  search_and_display(query)
rescue ApiError => e
  handle_api_error(e)
rescue ArgumentError => e
  error(e.message)
  1
end