3llo 1.0.0.pre.rc.0 → 1.3.1.pre.rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +4 -0
  3. data/.rubocop.yml +122 -0
  4. data/3llo.gemspec +11 -11
  5. data/CHANGELOG.md +21 -0
  6. data/Gemfile +3 -3
  7. data/LICENSE +2 -1
  8. data/Rakefile +3 -9
  9. data/bin/3llo +4 -4
  10. data/lib/3llo/api/board.rb +23 -27
  11. data/lib/3llo/api/card.rb +87 -103
  12. data/lib/3llo/api/checklist.rb +26 -48
  13. data/lib/3llo/api/label.rb +64 -0
  14. data/lib/3llo/api/list.rb +22 -23
  15. data/lib/3llo/api/token.rb +2 -2
  16. data/lib/3llo/api/user.rb +8 -32
  17. data/lib/3llo/api.rb +7 -6
  18. data/lib/3llo/application.rb +32 -22
  19. data/lib/3llo/command/board/add.rb +29 -0
  20. data/lib/3llo/command/board.rb +7 -9
  21. data/lib/3llo/command/card/add.rb +12 -8
  22. data/lib/3llo/command/card/add_label.rb +56 -0
  23. data/lib/3llo/command/card/assign.rb +3 -3
  24. data/lib/3llo/command/card/edit.rb +33 -0
  25. data/lib/3llo/command/card/move.rb +3 -7
  26. data/lib/3llo/command/card/self_assign.rb +2 -2
  27. data/lib/3llo/command/card.rb +42 -53
  28. data/lib/3llo/command/label/add.rb +22 -0
  29. data/lib/3llo/command/label/edit.rb +37 -0
  30. data/lib/3llo/command/label/invalid.rb +18 -0
  31. data/lib/3llo/command/label/list.rb +18 -0
  32. data/lib/3llo/command/label/remove.rb +28 -0
  33. data/lib/3llo/command/label.rb +47 -0
  34. data/lib/3llo/command/list/add.rb +21 -0
  35. data/lib/3llo/command/list.rb +10 -9
  36. data/lib/3llo/command.rb +47 -14
  37. data/lib/3llo/controller.rb +28 -13
  38. data/lib/3llo/entities.rb +2 -2
  39. data/lib/3llo/interface.rb +3 -2
  40. data/lib/3llo/registry.rb +3 -4
  41. data/lib/3llo/remote_server.rb +99 -0
  42. data/lib/3llo/utils.rb +18 -0
  43. data/lib/3llo/version.rb +1 -1
  44. data/lib/3llo/view/board/help.rb +1 -0
  45. data/lib/3llo/view/board/list.rb +2 -2
  46. data/lib/3llo/view/card/help.rb +2 -1
  47. data/lib/3llo/view/help.rb +2 -0
  48. data/lib/3llo/view/label/help.rb +20 -0
  49. data/lib/3llo/view/label/list.rb +21 -0
  50. data/lib/3llo/view/list/help.rb +1 -0
  51. data/lib/3llo/view.rb +13 -11
  52. data/lib/3llo.rb +14 -14
  53. metadata +38 -9
  54. data/lib/3llo/http/client.rb +0 -95
  55. data/lib/3llo/http/request_error.rb +0 -18
@@ -0,0 +1,33 @@
1
+ module Tr3llo
2
+ module Command
3
+ module Card
4
+ module Edit
5
+ extend self
6
+
7
+ def execute(card_key)
8
+ card_id = Entities.parse_id(:card, card_key)
9
+ assert_card_id!(card_id, card_key)
10
+
11
+ card = API::Card.find(card_id)
12
+
13
+ interface = Application.fetch_interface!()
14
+
15
+ interface.print_frame do
16
+ name = interface.input.ask("Name:", required: true, value: card.name)
17
+ description = interface.input.ask("Description:", value: card.description)
18
+
19
+ API::Card.update(card_id, {"name" => name, "desc" => description})
20
+
21
+ interface.puts("Card has been updated.")
22
+ end
23
+ end
24
+
25
+ private
26
+
27
+ def assert_card_id!(card_id, key)
28
+ raise InvalidArgumentError.new("#{key.inspect} is not a valid list key") unless card_id
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -23,9 +23,9 @@ module Tr3llo
23
23
  def select_list(interface, board_id)
24
24
  list_options =
25
25
  API::List
26
- .find_all_by_board(board_id)
27
- .map { |list| [list.name, list.id] }
28
- .to_h()
26
+ .find_all_by_board(board_id)
27
+ .map { |list| [list.name, list.id] }
28
+ .to_h()
29
29
 
30
30
  interface.input.select(
31
31
  "Choose the list to be moved to",
@@ -33,10 +33,6 @@ module Tr3llo
33
33
  )
34
34
  end
35
35
 
36
- def move_card!(card_id, list_id)
37
- API::Card.move_to_list(card_id, list_id)
38
- end
39
-
40
36
  def assert_card_id!(card_id, key)
41
37
  raise InvalidArgumentError.new("#{key.inspect} is not a valid card key") unless card_id
42
38
  end
@@ -8,7 +8,7 @@ module Tr3llo
8
8
  card_id = Entities.parse_id(:card, key)
9
9
  assert_card_id!(card_id, key)
10
10
 
11
- card = assign_card(card_id, user_id)
11
+ assign_card(card_id, user_id)
12
12
 
13
13
  interface = Application.fetch_interface!()
14
14
 
@@ -21,7 +21,7 @@ module Tr3llo
21
21
 
22
22
  def assign_card(card_id, user_id)
23
23
  card = API::Card.find(card_id)
24
- members = card.members.map { |member| member.id } + [user_id]
24
+ members = card.members.map(&:id) + [user_id]
25
25
 
26
26
  API::Card.assign_members(card_id, members)
27
27
  end
@@ -1,22 +1,4 @@
1
- require '3llo/command/card/list'
2
- require '3llo/command/card/list_mine'
3
- require '3llo/command/card/show'
4
- require '3llo/command/card/move'
5
- require '3llo/command/card/self_assign'
6
- require '3llo/command/card/assign'
7
- require '3llo/command/card/invalid'
8
- require '3llo/command/card/comments'
9
- require '3llo/command/card/comment'
10
- require '3llo/command/card/add'
11
- require '3llo/command/card/archive'
12
- require '3llo/command/card/add_checklist'
13
- require '3llo/command/card/edit_checklist'
14
- require '3llo/command/card/remove_checklist'
15
- require '3llo/command/card/add_item'
16
- require '3llo/command/card/check_item'
17
- require '3llo/command/card/uncheck_item'
18
- require '3llo/command/card/edit_item'
19
- require '3llo/command/card/remove_item'
1
+ Tr3llo::Utils.require_directory(File.dirname(__FILE__) + "/card/*.rb")
20
2
 
21
3
  module Tr3llo
22
4
  module Command
@@ -25,104 +7,111 @@ module Tr3llo
25
7
 
26
8
  def execute(subcommand, args)
27
9
  case subcommand
28
- when 'list'
29
- is_mine, _ = *args
10
+ when "list"
30
11
  board = Application.fetch_board!()
31
12
 
32
- if is_mine == 'mine'
33
- user = Application.fetch_user!()
34
- Command::Card::ListMine.execute(board[:id], user[:id])
35
- elsif is_mine.nil?
36
- Command::Card::List.execute(board[:id])
37
- else
38
- command_string = "card list #{is_mine}"
39
- raise InvalidArgumentError.new("#{command_string.inspect} is not a valid command")
40
- end
41
- when 'add'
13
+ Command::Card::List.execute(board.id)
14
+ when "list-mine"
15
+ board = Application.fetch_board!()
16
+ user = Application.fetch_user!()
17
+
18
+ Command::Card::ListMine.execute(board.id, user.id)
19
+ when "add"
42
20
  board = Application.fetch_board!()
43
21
  Command::Card::Add.execute(board[:id])
44
- when 'show'
45
- card_key, _ = args
22
+ when "show"
23
+ card_key, = args
46
24
  Utils.assert_string!(card_key, "card key is missing")
47
25
 
48
26
  Command::Card::Show.execute(card_key)
49
- when 'comments'
50
- card_key, _ = args
27
+ when "edit"
28
+ card_key, = args
29
+ Utils.assert_string!(card_key, "card key is missing")
30
+
31
+ Command::Card::Edit.execute(card_key)
32
+ when "comments"
33
+ card_key, = args
51
34
  Utils.assert_string!(card_key, "card key is missing")
52
35
 
53
36
  Command::Card::Comments.execute(card_key)
54
- when 'comment'
55
- card_key, _ = args
37
+ when "comment"
38
+ card_key, = args
56
39
  Utils.assert_string!(card_key, "card key is missing")
57
40
 
58
41
  Command::Card::Comment.execute(card_key)
59
- when 'move'
42
+ when "move"
60
43
  board = Application.fetch_board!()
61
- card_key, _ = args
44
+ card_key, = args
62
45
  Utils.assert_string!(card_key, "card key is missing")
63
46
 
64
47
  Command::Card::Move.execute(card_key, board[:id])
65
- when 'self-assign'
48
+ when "self-assign"
66
49
  user = Application.fetch_user!()
67
- card_key, _ = args
50
+ card_key, = args
68
51
  Utils.assert_string!(card_key, "card key is missing")
69
52
 
70
53
  Command::Card::SelfAssign.execute(card_key, user[:id])
71
- when 'assign'
54
+ when "assign"
72
55
  board = Application.fetch_board!()
73
- card_key, _ = args
56
+ card_key, = args
74
57
  Utils.assert_string!(card_key, "card key is missing")
75
58
 
76
59
  Command::Card::Assign.execute(card_key, board[:id])
77
- when 'archive'
78
- card_key, _ = args
60
+ when "archive"
61
+ card_key, = args
79
62
  Utils.assert_string!(card_key, "card key is missing")
80
63
 
81
64
  Command::Card::Archive.execute(card_key)
82
65
  when "add-checklist"
83
- card_key, _ = args
66
+ card_key, = args
84
67
  Utils.assert_string!(card_key, "card key is missing")
85
68
 
86
69
  Command::Card::AddChecklist.execute(card_key)
87
70
  when "edit-checklist"
88
- checklist_key, _ = args
71
+ checklist_key, = args
89
72
  Utils.assert_string!(checklist_key, "checklist key is missing")
90
73
 
91
74
  Command::Card::EditChecklist.execute(checklist_key)
92
75
  when "remove-checklist"
93
- checklist_key, _ = args
76
+ checklist_key, = args
94
77
  Utils.assert_string!(checklist_key, "checklist key is missing")
95
78
 
96
79
  Command::Card::RemoveChecklist.execute(checklist_key)
97
80
  when "add-item"
98
- checklist_key, _ = args
81
+ checklist_key, = args
99
82
  Utils.assert_string!(checklist_key, "checklist key is missing")
100
83
 
101
84
  Command::Card::AddItem.execute(checklist_key)
102
85
  when "check-item"
103
- card_key, check_item_key, _ = args
86
+ card_key, check_item_key, = args
104
87
  Utils.assert_string!(card_key, "card key is missing")
105
88
  Utils.assert_string!(check_item_key, "item key is missing")
106
89
 
107
90
  Command::Card::CheckItem.execute(card_key, check_item_key)
108
91
  when "uncheck-item"
109
- card_key, check_item_key, _ = args
92
+ card_key, check_item_key, = args
110
93
  Utils.assert_string!(card_key, "card key is missing")
111
94
  Utils.assert_string!(check_item_key, "item key is missing")
112
95
 
113
96
  Command::Card::UncheckItem.execute(card_key, check_item_key)
114
97
  when "edit-item"
115
- card_key, check_item_key, _ = args
98
+ card_key, check_item_key, = args
116
99
  Utils.assert_string!(card_key, "card key is missing")
117
100
  Utils.assert_string!(check_item_key, "item key is missing")
118
101
 
119
102
  Command::Card::EditItem.execute(card_key, check_item_key)
120
103
  when "remove-item"
121
- card_key, check_item_key, _ = args
104
+ card_key, check_item_key, = args
122
105
  Utils.assert_string!(card_key, "card key is missing")
123
106
  Utils.assert_string!(check_item_key, "item key is missing")
124
107
 
125
108
  Command::Card::RemoveItem.execute(card_key, check_item_key)
109
+ when "add-label"
110
+ board = Application.fetch_board!()
111
+ card_key, = args
112
+ Utils.assert_string!(card_key, "card key is missing")
113
+
114
+ Command::Card::AddLabel.execute(card_key, board[:id])
126
115
  else
127
116
  handle_invalid_subcommand(subcommand, args)
128
117
  end
@@ -0,0 +1,22 @@
1
+ module Tr3llo
2
+ module Command
3
+ module Label
4
+ module Add
5
+ extend self
6
+
7
+ def execute(board_id)
8
+ interface = Application.fetch_interface!()
9
+
10
+ interface.print_frame do
11
+ name = interface.input.ask("Name:", required: true)
12
+ color = interface.input.select("Choose the color:", Utils::TRELLO_LABEL_COLOR)
13
+
14
+ API::Label.create(name: name, color: color, board_id: board_id)
15
+
16
+ interface.puts("Label has been created.")
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,37 @@
1
+ module Tr3llo
2
+ module Command
3
+ module Label
4
+ module Edit
5
+ extend self
6
+
7
+ def execute(label_key)
8
+ label_id = Entities.parse_id(:label, label_key)
9
+ assert_label_id!(label_id, label_key)
10
+
11
+ label = API::Label.find(label_id)
12
+
13
+ interface = Application.fetch_interface!()
14
+
15
+ interface.print_frame do
16
+ name = interface.input.ask("Name:", required: true, value: label.name)
17
+ color = interface.input.select(
18
+ "Choose the color:",
19
+ Utils::TRELLO_LABEL_COLOR,
20
+ default: Utils::TRELLO_LABEL_COLOR.index(label.color)
21
+ )
22
+
23
+ API::Label.update(label_id, {"name" => name, "color" => color})
24
+
25
+ interface.puts("Label has been updated.")
26
+ end
27
+ end
28
+
29
+ private
30
+
31
+ def assert_label_id!(label_id, key)
32
+ raise InvalidArgumentError.new("#{key.inspect} is not a valid label key") unless label_id
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,18 @@
1
+ module Tr3llo
2
+ module Command
3
+ module Label
4
+ module Invalid
5
+ extend self
6
+
7
+ def execute(message)
8
+ interface = Application.fetch_interface!()
9
+
10
+ interface.print_frame do
11
+ interface.print_error(message)
12
+ interface.puts(View::Label::Help.render())
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ module Tr3llo
2
+ module Command
3
+ module Label
4
+ module List
5
+ extend self
6
+
7
+ def execute(board_id)
8
+ interface = Application.fetch_interface!()
9
+ labels = API::Label.find_all_by_board(board_id)
10
+
11
+ interface.print_frame do
12
+ interface.puts(View::Label::List.render(labels))
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,28 @@
1
+ module Tr3llo
2
+ module Command
3
+ module Label
4
+ module Remove
5
+ extend self
6
+
7
+ def execute(label_key)
8
+ label_id = Entities.parse_id(:label, label_key)
9
+ assert_label_id!(label_id, label_key)
10
+
11
+ interface = Application.fetch_interface!()
12
+
13
+ interface.print_frame do
14
+ API::Label.delete(label_id)
15
+
16
+ interface.puts("Label has been deleted.")
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ def assert_label_id!(label_id, key)
23
+ raise InvalidArgumentError.new("#{key.inspect} is not a valid label key") unless label_id
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,47 @@
1
+ Tr3llo::Utils.require_directory(File.dirname(__FILE__) + "/label/*.rb")
2
+
3
+ module Tr3llo
4
+ module Command
5
+ module Label
6
+ extend self
7
+
8
+ def execute(subcommand, args)
9
+ case subcommand
10
+ when "list"
11
+ board = Application.fetch_board!()
12
+
13
+ Command::Label::List.execute(board[:id])
14
+ when "add"
15
+ board = Application.fetch_board!()
16
+
17
+ Command::Label::Add.execute(board[:id])
18
+ when "edit"
19
+ label_key, = args
20
+ Utils.assert_string!(label_key, "label key is missing")
21
+
22
+ Command::Label::Edit.execute(label_key)
23
+ when "remove"
24
+ label_key, = args
25
+ Utils.assert_string!(label_key, "label key is missing")
26
+
27
+ Command::Label::Remove.execute(label_key)
28
+ else
29
+ handle_invalid_subcommand(subcommand, args)
30
+ end
31
+ rescue InvalidArgumentError, InvalidCommandError, BoardNotSelectedError => exception
32
+ Command::Label::Invalid.execute(exception.message)
33
+ end
34
+
35
+ private
36
+
37
+ def handle_invalid_subcommand(subcommand, _args)
38
+ case subcommand
39
+ when String
40
+ raise InvalidCommandError.new("#{subcommand.inspect} is not a valid command")
41
+ when NilClass
42
+ raise InvalidCommandError.new("command is missing")
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,21 @@
1
+ module Tr3llo
2
+ module Command
3
+ module List
4
+ module Add
5
+ extend self
6
+
7
+ def execute(board_id)
8
+ interface = Application.fetch_interface!()
9
+
10
+ interface.print_frame do
11
+ name = interface.input.ask("Name:", required: true)
12
+
13
+ API::List.create(name, board_id)
14
+
15
+ interface.puts("List has been created.")
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,7 +1,4 @@
1
- require '3llo/command/list/list'
2
- require '3llo/command/list/cards'
3
- require '3llo/command/list/invalid'
4
- require '3llo/command/list/archive_cards'
1
+ Tr3llo::Utils.require_directory(File.dirname(__FILE__) + "/list/*.rb")
5
2
 
6
3
  module Tr3llo
7
4
  module Command
@@ -10,17 +7,21 @@ module Tr3llo
10
7
 
11
8
  def execute(subcommand, args)
12
9
  case subcommand
13
- when 'list'
10
+ when "list"
14
11
  board = Application.fetch_board!()
15
12
 
16
13
  Command::List::List.execute(board[:id])
17
- when 'cards'
18
- list_key, _ = args
14
+ when "add"
15
+ board = Application.fetch_board!()
16
+
17
+ Command::List::Add.execute(board[:id])
18
+ when "cards"
19
+ list_key, = args
19
20
  Utils.assert_string!(list_key, "list key is missing")
20
21
 
21
22
  Command::List::Cards.execute(list_key)
22
- when 'archive-cards'
23
- list_key, _ = args
23
+ when "archive-cards"
24
+ list_key, = args
24
25
  Utils.assert_string!(list_key, "list key is missing")
25
26
 
26
27
  Command::List::ArchiveCards.execute(list_key)
data/lib/3llo/command.rb CHANGED
@@ -1,9 +1,10 @@
1
- require '3llo/command/board'
2
- require '3llo/command/card'
3
- require '3llo/command/list'
4
- require '3llo/command/help'
5
- require '3llo/command/exit'
6
- require '3llo/command/invalid'
1
+ require "3llo/command/board"
2
+ require "3llo/command/card"
3
+ require "3llo/command/list"
4
+ require "3llo/command/label"
5
+ require "3llo/command/help"
6
+ require "3llo/command/exit"
7
+ require "3llo/command/invalid"
7
8
 
8
9
  module Tr3llo
9
10
  module Command
@@ -13,35 +14,67 @@ module Tr3llo
13
14
  build_command(command_buffer)
14
15
  end
15
16
 
17
+ def generate_suggestions(buffer, command_buffer)
18
+ commands = {
19
+ "board" => %w[add list select],
20
+ "list" => %w[list add cards archive-cards],
21
+ "card" => %w[
22
+ list show add edit archive list-mine move
23
+ comment comments self-assign assign
24
+ add-checklist edit-checklist remove-checklist
25
+ add-item edit-item remote-item check-item uncheck-item add-label
26
+ ],
27
+ "label" => %w[list add edit remove],
28
+ "help" => [],
29
+ "exit" => []
30
+ }
31
+
32
+ command, _subcommand, _args = parse_command(command_buffer)
33
+
34
+ if commands.has_key?(command)
35
+ subcommands = commands.fetch(command)
36
+
37
+ subcommands
38
+ .grep(/^#{Regexp.escape(buffer)}/)
39
+ .reject { |suggestion| suggestion == buffer }
40
+ else
41
+ commands.keys.grep(/^#{Regexp.escape(buffer)}/)
42
+ end
43
+ end
44
+
16
45
  private
17
46
 
18
47
  def build_command(command_string)
19
48
  command, subcommand, *args = parse_command(command_string)
20
49
 
21
50
  case command
22
- when 'board'
51
+ when "board"
23
52
  Command::Board.execute(subcommand, args)
24
- when 'card'
53
+ when "card"
25
54
  Command::Card.execute(subcommand, args)
26
- when 'list'
55
+ when "list"
27
56
  Command::List.execute(subcommand, args)
28
- when 'help'
57
+ when "label"
58
+ Command::Label.execute(subcommand, args)
59
+ when "help"
29
60
  Command::Help.execute()
30
- when 'exit'
61
+ when "exit"
31
62
  Command::Exit.execute()
32
63
  else
33
64
  if command
34
- raise InvalidCommandError.new("#{command.inspect} is not a valid command. Run #{"help".inspect} to display the document.")
65
+ raise InvalidCommandError.new(
66
+ "#{command.inspect} is not a valid command. Run #{"help".inspect} to display the document."
67
+ )
35
68
  else
36
69
  raise InvalidCommandError.new("command is missing")
37
70
  end
38
71
  end
39
- rescue InvalidCommandError => exception
72
+ rescue InvalidCommandError, RemoteServer::RequestError => exception
40
73
  Command::Invalid.execute(exception.message)
41
74
  end
42
75
 
43
76
  def parse_command(command_string)
44
- command_string.strip.split(' ')
77
+ command_string.strip.split(" ").map(&:strip)
45
78
  end
46
79
  end
47
80
  end
@@ -1,37 +1,52 @@
1
- require 'readline'
1
+ require "readline"
2
2
 
3
3
  module Tr3llo
4
4
  module Controller
5
5
  extend self
6
6
 
7
7
  def start(init_command)
8
- list = %w(board card help list mine move select self-assign show)
9
- auto_completion = proc { |s| list.grep( /^#{Regexp.escape(s)}/ ) }
10
-
11
8
  Readline.completion_append_character = " "
12
- Readline.completion_proc = auto_completion
9
+ Readline.completion_proc = lambda { |buffer|
10
+ Command.generate_suggestions(buffer, Readline.line_buffer)
11
+ }
13
12
 
14
13
  interface = Application.fetch_interface!()
15
14
 
16
15
  if init_command && init_command != ""
17
- interface.puts("Executing " + Utils.format_highlight(init_command) + " command")
18
-
19
- execute_command!(init_command, interface)
16
+ init_commands = init_command.split(";")
17
+ init_commands.each do |cmd|
18
+ interface.puts("Executing " + Utils.format_highlight(cmd) + " command")
19
+ execute_command!(cmd)
20
+ end
20
21
  end
21
22
 
22
23
  loop do
23
- command_buffer = Readline.readline("\e[15;48;5;27m 3llo \e[0m > ", true)
24
+ status_line = determine_status_line()
25
+ command_buffer = Readline.readline(status_line, true)
26
+ Command::Exit.execute() if command_buffer.nil?
24
27
 
25
- execute_command!(command_buffer, interface)
28
+ execute_command!(command_buffer)
26
29
  end
27
30
  rescue Interrupt
28
31
  Command::Exit.execute()
29
32
  end
30
33
 
31
- def execute_command!(command_buffer, interface)
34
+ private
35
+
36
+ def determine_status_line()
37
+ program_name = ["\e[15;48;5;27m 3llo \e[0m"]
38
+ board_name =
39
+ begin
40
+ ["\e[45m #{Application.fetch_board!().name} \e[0m"]
41
+ rescue BoardNotSelectedError
42
+ []
43
+ end
44
+
45
+ (program_name + board_name + [""]).join(" > ")
46
+ end
47
+
48
+ def execute_command!(command_buffer)
32
49
  Tr3llo::Command.execute(command_buffer.strip())
33
- rescue Tr3llo::HTTP::Client::RequestError => e
34
- interface.print_frame { interface.print_error(e.message) }
35
50
  end
36
51
  end
37
52
  end
data/lib/3llo/entities.rb CHANGED
@@ -2,7 +2,7 @@ module Tr3llo
2
2
  module Entities
3
3
  extend self
4
4
 
5
- SHORTCUT_PREFIX = "#"
5
+ SHORTCUT_PREFIX = "#".freeze
6
6
 
7
7
  InvalidKeyError = Class.new(ArgumentError)
8
8
  InvalidIDError = Class.new(ArgumentError)
@@ -11,7 +11,7 @@ module Tr3llo
11
11
  Board = Struct.new(:id, :shortcut, :name)
12
12
  List = Struct.new(:id, :shortcut, :name)
13
13
  Card = Struct.new(:id, :shortcut, :name, :description, :short_url, :labels, :members, :list, keyword_init: true)
14
- Label = Struct.new(:name, :color)
14
+ Label = Struct.new(:id, :shortcut, :name, :color, keyword_init: true)
15
15
  Comment = Struct.new(:id, :text, :creator, :created_at, keyword_init: true)
16
16
  Checklist = Struct.new(:id, :shortcut, :name, :items, keyword_init: true)
17
17
  Checklist::Item = Struct.new(:id, :shortcut, :name, :state, keyword_init: true)
@@ -1,7 +1,8 @@
1
1
  module Tr3llo
2
2
  class Interface
3
3
  def initialize(input, output)
4
- @input, @output = input, output
4
+ @input = input
5
+ @output = output
5
6
  end
6
7
 
7
8
  def print_frame
@@ -15,7 +16,7 @@ module Tr3llo
15
16
  output.puts(str)
16
17
  end
17
18
 
18
- alias :puts :print_line
19
+ alias puts print_line
19
20
 
20
21
  def print(str)
21
22
  output.print(str)