Module: Tr3llo::Command::Board

Extended by:
Board
Included in:
Board
Defined in:
lib/3llo/command/board.rb,
lib/3llo/command/board/add.rb,
lib/3llo/command/board/list.rb,
lib/3llo/command/board/select.rb,
lib/3llo/command/board/invalid.rb

Defined Under Namespace

Modules: Add, Invalid, List, Select

Instance Method Summary collapse

Instance Method Details

#execute(subcommand, args) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/3llo/command/board.rb', line 8

def execute(subcommand, args)
  case subcommand
  when "list"
    user = Application.fetch_user!()

    Command::Board::List.execute(user[:id])
  when "select"
    board_key, = args
    Utils.assert_string!(board_key, "board key is missing")

    Command::Board::Select.execute(board_key)
  when "add"
    Command::Board::Add.execute()
  else
    handle_invalid_subcommand(subcommand, args)
  end
rescue InvalidCommandError, InvalidArgumentError => exception
  Command::Board::Invalid.execute(exception.message)
end