Class: Slk::Commands::Workspaces

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

Overview

Manages configured Slack workspaces 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

#dispatch_actionObject



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

def dispatch_action
  case positional_args
  in ['list'] | [] then list_workspaces
  in ['add'] then add_workspace
  in ['remove', name] then remove_workspace(name)
  in ['primary'] then show_primary
  in ['primary', name] then set_primary(name)
  else unknown_action
  end
end

#executeObject



10
11
12
13
14
15
# File 'lib/slk/commands/workspaces.rb', line 10

def execute
  result = validate_options
  return result if result

  dispatch_action
end

#unknown_actionObject



28
29
30
31
# File 'lib/slk/commands/workspaces.rb', line 28

def unknown_action
  error("Unknown action: #{positional_args.first}")
  1
end