3llo 1.1.0 → 1.2.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.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/3llo.gemspec +2 -2
- data/CHANGELOG.md +7 -0
- data/LICENSE +2 -1
- data/lib/3llo.rb +0 -1
- data/lib/3llo/api/card.rb +8 -1
- data/lib/3llo/command.rb +1 -1
- data/lib/3llo/command/board.rb +1 -4
- data/lib/3llo/command/card.rb +7 -20
- data/lib/3llo/command/card/add.rb +1 -1
- data/lib/3llo/command/card/add_label.rb +56 -0
- data/lib/3llo/command/card/move.rb +0 -4
- data/lib/3llo/command/label.rb +1 -5
- data/lib/3llo/command/list.rb +1 -5
- data/lib/3llo/controller.rb +19 -5
- data/lib/3llo/utils.rb +6 -0
- data/lib/3llo/version.rb +1 -1
- data/lib/3llo/view/card/help.rb +1 -0
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 924f5388e35597e1570a41cc0e0d346d999a6c5a354904e2d4db189579a5047d
|
4
|
+
data.tar.gz: 0d6d728e7831db53095118317a12e3d952793ecdae041db2dd75ca6d8282f515
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11c88432c0490b325080423edee099ac78263f7f0efcb7ef0f9d81d5348733d26649bddfcb335452946b5b8150b2dc539fb224094f6efeabc128ee14694cc198
|
7
|
+
data.tar.gz: '0318a410ef4b35661a9442cab3cdf9a22dcec2cda1645e0000e6eab0629b38ea6df4c97183dae1beb814b444bbd05a841d7da4db1f86aea1882207466f91664d'
|
data/.rubocop.yml
CHANGED
data/3llo.gemspec
CHANGED
@@ -5,8 +5,8 @@ require "3llo/version"
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "3llo"
|
7
7
|
spec.version = Tr3llo::VERSION
|
8
|
-
spec.authors = ["Cẩm Huỳnh"]
|
9
|
-
spec.email = ["huynhquancam@gmail.com"]
|
8
|
+
spec.authors = ["Cẩm Huỳnh", "Diệp Sở Hùng"]
|
9
|
+
spec.email = ["huynhquancam@gmail.com", "diepsohung@gmail.com"]
|
10
10
|
|
11
11
|
spec.summary = "Trello CLI app"
|
12
12
|
spec.description = "Interactive CLI application for Trello"
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## v1.2.0
|
4
|
+
|
5
|
+
* Support running multiple commands with `--init` switch (#83)
|
6
|
+
* Include current board name to status line (#77)
|
7
|
+
* Introduce `card add-label` command (#74)
|
8
|
+
* Support multiline card description (#72)
|
9
|
+
|
3
10
|
## v1.1.0
|
4
11
|
|
5
12
|
* Introduce "list add" command.
|
data/LICENSE
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2017
|
3
|
+
Copyright (c) 2017 Cẩm Huỳnh
|
4
|
+
Copyright (c) 2020 Cẩm Huỳnh and Diệp Sở Hùng
|
4
5
|
|
5
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
7
|
of this software and associated documentation files (the "Software"), to deal
|
data/lib/3llo.rb
CHANGED
data/lib/3llo/api/card.rb
CHANGED
@@ -116,6 +116,12 @@ module Tr3llo
|
|
116
116
|
client.put(req_path, {}, payload)
|
117
117
|
end
|
118
118
|
|
119
|
+
def add_labels(card_id, labels)
|
120
|
+
req_path = Utils.build_req_path("/cards/#{card_id}/idLabels")
|
121
|
+
|
122
|
+
client.put(req_path, {}, {"value" => labels.join(",")})
|
123
|
+
end
|
124
|
+
|
119
125
|
private
|
120
126
|
|
121
127
|
def make_struct(payload)
|
@@ -135,10 +141,11 @@ module Tr3llo
|
|
135
141
|
payload
|
136
142
|
.fetch("labels", [])
|
137
143
|
.map do |label_payload|
|
144
|
+
label_id = label_payload.fetch("id")
|
138
145
|
label_name = label_payload.fetch("name")
|
139
146
|
label_color = label_payload["color"]
|
140
147
|
|
141
|
-
Entities::Label.new(id:
|
148
|
+
Entities::Label.new(id: label_id, shortcut: nil, name: label_name, color: label_color)
|
142
149
|
end
|
143
150
|
|
144
151
|
card =
|
data/lib/3llo/command.rb
CHANGED
@@ -22,7 +22,7 @@ module Tr3llo
|
|
22
22
|
list show add edit archive list-mine move
|
23
23
|
comment comments self-assign assign
|
24
24
|
add-checklist edit-checklist remove-checklist
|
25
|
-
add-item edit-item remote-item check-item uncheck-item
|
25
|
+
add-item edit-item remote-item check-item uncheck-item add-label
|
26
26
|
],
|
27
27
|
"label" => %w[list add edit remove],
|
28
28
|
"help" => [],
|
data/lib/3llo/command/board.rb
CHANGED
data/lib/3llo/command/card.rb
CHANGED
@@ -1,23 +1,4 @@
|
|
1
|
-
|
2
|
-
require "3llo/command/card/list_mine"
|
3
|
-
require "3llo/command/card/edit"
|
4
|
-
require "3llo/command/card/show"
|
5
|
-
require "3llo/command/card/move"
|
6
|
-
require "3llo/command/card/self_assign"
|
7
|
-
require "3llo/command/card/assign"
|
8
|
-
require "3llo/command/card/invalid"
|
9
|
-
require "3llo/command/card/comments"
|
10
|
-
require "3llo/command/card/comment"
|
11
|
-
require "3llo/command/card/add"
|
12
|
-
require "3llo/command/card/archive"
|
13
|
-
require "3llo/command/card/add_checklist"
|
14
|
-
require "3llo/command/card/edit_checklist"
|
15
|
-
require "3llo/command/card/remove_checklist"
|
16
|
-
require "3llo/command/card/add_item"
|
17
|
-
require "3llo/command/card/check_item"
|
18
|
-
require "3llo/command/card/uncheck_item"
|
19
|
-
require "3llo/command/card/edit_item"
|
20
|
-
require "3llo/command/card/remove_item"
|
1
|
+
Tr3llo::Utils.require_directory(File.dirname(__FILE__) + "/card/*.rb")
|
21
2
|
|
22
3
|
module Tr3llo
|
23
4
|
module Command
|
@@ -125,6 +106,12 @@ module Tr3llo
|
|
125
106
|
Utils.assert_string!(check_item_key, "item key is missing")
|
126
107
|
|
127
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])
|
128
115
|
else
|
129
116
|
handle_invalid_subcommand(subcommand, args)
|
130
117
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Tr3llo
|
2
|
+
module Command
|
3
|
+
module Card
|
4
|
+
module AddLabel
|
5
|
+
extend self
|
6
|
+
|
7
|
+
def execute(key, board_id)
|
8
|
+
card_id = Entities.parse_id(:card, key)
|
9
|
+
assert_card_id!(card_id, key)
|
10
|
+
|
11
|
+
card = API::Card.find(card_id)
|
12
|
+
|
13
|
+
interface = Application.fetch_interface!()
|
14
|
+
|
15
|
+
interface.print_frame do
|
16
|
+
label_ids = select_labels(interface, card, board_id)
|
17
|
+
|
18
|
+
add_labels(card_id, label_ids)
|
19
|
+
interface.puts("Chosen labels have been added to the card.")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def assert_card_id!(card_id, key)
|
26
|
+
raise InvalidArgumentError.new("#{key.inspect} is not a valid card key") unless card_id
|
27
|
+
end
|
28
|
+
|
29
|
+
def add_labels(card_id, label_ids)
|
30
|
+
API::Card.add_labels(card_id, label_ids)
|
31
|
+
end
|
32
|
+
|
33
|
+
def select_labels(interface, card, board_id)
|
34
|
+
label_options =
|
35
|
+
API::Label.find_all_by_board(board_id)
|
36
|
+
.map { |label| [label.name, label.id] }
|
37
|
+
.to_h()
|
38
|
+
|
39
|
+
preselected_label_ids =
|
40
|
+
card.labels.flat_map do |label|
|
41
|
+
index = label_options.find_index { |_label_name, label_id| label_id == label.id }
|
42
|
+
|
43
|
+
index ? [index + 1] : []
|
44
|
+
end
|
45
|
+
|
46
|
+
interface.input.multi_select(
|
47
|
+
"Choose the labels to add to this card:",
|
48
|
+
label_options,
|
49
|
+
default: preselected_label_ids,
|
50
|
+
enum: "."
|
51
|
+
)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
data/lib/3llo/command/label.rb
CHANGED
@@ -1,8 +1,4 @@
|
|
1
|
-
|
2
|
-
require "3llo/command/label/add"
|
3
|
-
require "3llo/command/label/edit"
|
4
|
-
require "3llo/command/label/remove"
|
5
|
-
require "3llo/command/label/invalid"
|
1
|
+
Tr3llo::Utils.require_directory(File.dirname(__FILE__) + "/label/*.rb")
|
6
2
|
|
7
3
|
module Tr3llo
|
8
4
|
module Command
|
data/lib/3llo/command/list.rb
CHANGED
@@ -1,8 +1,4 @@
|
|
1
|
-
|
2
|
-
require "3llo/command/list/add"
|
3
|
-
require "3llo/command/list/cards"
|
4
|
-
require "3llo/command/list/invalid"
|
5
|
-
require "3llo/command/list/archive_cards"
|
1
|
+
Tr3llo::Utils.require_directory(File.dirname(__FILE__) + "/list/*.rb")
|
6
2
|
|
7
3
|
module Tr3llo
|
8
4
|
module Command
|
data/lib/3llo/controller.rb
CHANGED
@@ -13,14 +13,16 @@ module Tr3llo
|
|
13
13
|
interface = Application.fetch_interface!()
|
14
14
|
|
15
15
|
if init_command && init_command != ""
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
19
21
|
end
|
20
22
|
|
21
23
|
loop do
|
22
|
-
|
23
|
-
|
24
|
+
status_line = determine_status_line()
|
25
|
+
command_buffer = Readline.readline(status_line, true)
|
24
26
|
Command::Exit.execute() if command_buffer.nil?
|
25
27
|
|
26
28
|
execute_command!(command_buffer)
|
@@ -31,6 +33,18 @@ module Tr3llo
|
|
31
33
|
|
32
34
|
private
|
33
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
|
+
|
34
48
|
def execute_command!(command_buffer)
|
35
49
|
Tr3llo::Command.execute(command_buffer.strip())
|
36
50
|
end
|
data/lib/3llo/utils.rb
CHANGED
data/lib/3llo/version.rb
CHANGED
data/lib/3llo/view/card/help.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: 3llo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cẩm Huỳnh
|
8
|
-
|
8
|
+
- Diệp Sở Hùng
|
9
|
+
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2020-
|
12
|
+
date: 2020-12-06 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: tty-prompt
|
@@ -55,6 +56,7 @@ dependencies:
|
|
55
56
|
description: Interactive CLI application for Trello
|
56
57
|
email:
|
57
58
|
- huynhquancam@gmail.com
|
59
|
+
- diepsohung@gmail.com
|
58
60
|
executables:
|
59
61
|
- 3llo
|
60
62
|
extensions: []
|
@@ -91,6 +93,7 @@ files:
|
|
91
93
|
- lib/3llo/command/card/add.rb
|
92
94
|
- lib/3llo/command/card/add_checklist.rb
|
93
95
|
- lib/3llo/command/card/add_item.rb
|
96
|
+
- lib/3llo/command/card/add_label.rb
|
94
97
|
- lib/3llo/command/card/archive.rb
|
95
98
|
- lib/3llo/command/card/assign.rb
|
96
99
|
- lib/3llo/command/card/check_item.rb
|
@@ -153,7 +156,7 @@ licenses:
|
|
153
156
|
- MIT
|
154
157
|
metadata:
|
155
158
|
allowed_push_host: https://rubygems.org
|
156
|
-
post_install_message:
|
159
|
+
post_install_message:
|
157
160
|
rdoc_options: []
|
158
161
|
require_paths:
|
159
162
|
- lib
|
@@ -169,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
172
|
version: '0'
|
170
173
|
requirements: []
|
171
174
|
rubygems_version: 3.1.2
|
172
|
-
signing_key:
|
175
|
+
signing_key:
|
173
176
|
specification_version: 4
|
174
177
|
summary: Trello CLI app
|
175
178
|
test_files: []
|