3llo 0.3.0 → 0.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e05bd8d3c7bea9ee60906b240c091388184e4564
4
- data.tar.gz: 3c42a1c12897aba513a736b3afd84d3dcf624838
2
+ SHA256:
3
+ metadata.gz: d98e6963031445c64839dea30b0306cc264319fba049f12c0fe37bf3ef96d0a9
4
+ data.tar.gz: 3337c122e25299bb64cd0c12f12e83949c7d3ff17a96bed1c58757a53e631712
5
5
  SHA512:
6
- metadata.gz: d81e257f0a944ec5ab3dd6373814ee8d4ae0482d0029d169222b827865a10cbfff93b08a6f508dab1c2b068acbecc7f40dbf4d13fe8032617dbfd299e27e56b8
7
- data.tar.gz: fbaa8605fb23e12ecf5c93133bcbe70933b6eb8f7bcfe33cf4cae18920ecaca99fa6d355eed44e77e79fb37b060b046aa136b86e655be0931d2716b08eec77e1
6
+ metadata.gz: 6cbbaf758f34553fa23b48e206651bd3240f3065830e2156c2e9c2ca6f88dad161ee5a6d6cf43d1e09105911653eac634dc61ba3af39b90485d42e5425711edf
7
+ data.tar.gz: a532fd7bed771cb61d1004721a583dade9e3962a4e8edef3fafdbe495d3ad74e5846b47f6361930687e4b104707d1bf78f6166774ac403a8a100f619ad6d3540
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v0.3.1
4
+
5
+ * Improve self-documentation [#39](https://github.com/qcam/3llo/pull/39).
6
+
3
7
  ## v0.3.0
4
8
 
5
9
  * Accept multiline in "card comment" command [#33](https://github.com/qcam/3llo/pull/33).
data/README.md CHANGED
@@ -29,9 +29,10 @@ export TRELLO_TOKEN=your_token
29
29
 
30
30
  ### Obtain Trello API key and token
31
31
 
32
- 1. Go to [Get started](https://developers.trello.com/get-started/start-building).
33
- 2. Click on **Get your Application Key**.
34
- 3. Copy the Application Key and generate a Token using the instruction on the page.
32
+ 1. Ensure you're logged into your Trello account at [trello.com](https://trello.com)
33
+ 1. Visit [trello.com/app-key](https://trello.com/app-key), accept the Trello Developer Terms (if you're happy to do so) and press **Generate API Key**
34
+ 1. Copy the `Key` that's displayed at the top of the page and set this as an environment variable (`TRELLO_KEY`).
35
+ 1. Further down the page, follow the `Manually generate a token` link to generate a new API Token. Again, set this as an environment variable (`TRELLO_TOKEN`)
35
36
 
36
37
  ## Usage
37
38
 
data/bin/3llo CHANGED
@@ -10,10 +10,26 @@ $container.register(:api_client, Tr3llo::HTTP::Client)
10
10
  prompt = TTY::Prompt.new
11
11
  $container.register(:interface, Tr3llo::Interface.new(prompt, $stdout))
12
12
 
13
+ def print_help(stripped = false)
14
+ Tr3llo::Presenter::HelpPresenter
15
+ .new($container.resolve(:interface), stripped)
16
+ .print!
17
+ end
18
+
19
+ if ARGV.size == 1 && (ARGV[0] == "-h" || ARGV[0] == "--help")
20
+ print_help(true)
21
+ exit
22
+ end
23
+
13
24
  configuration = Tr3llo::Configuration.new
14
- configuration.user_id = ENV.fetch('TRELLO_USER') { raise "Have you set TRELLO_USER?" }
15
- configuration.api_key = ENV.fetch('TRELLO_KEY') { raise "Have you set TRELLO_KEY?" }
16
- configuration.api_token = ENV.fetch('TRELLO_TOKEN') { raise "Have you set TRELLO_TOKEN?" }
25
+ begin
26
+ configuration.user_id = ENV.fetch('TRELLO_USER') { raise "Have you set TRELLO_USER?" }
27
+ configuration.api_key = ENV.fetch('TRELLO_KEY') { raise "Have you set TRELLO_KEY?" }
28
+ configuration.api_token = ENV.fetch('TRELLO_TOKEN') { raise "Have you set TRELLO_TOKEN?" }
29
+ rescue => error
30
+ abort "Invalid configuration: \e[1m#{error.message}".colorize(31)
31
+ end
32
+
17
33
  configuration.finalize!
18
34
 
19
35
  $container.register(
@@ -24,8 +40,6 @@ $container.register(
24
40
  user = Tr3llo::API::User.find($container.resolve(:configuration).user_id)
25
41
  $container.register(:user, user)
26
42
 
27
- Tr3llo::Presenter::HelpPresenter
28
- .new($container.resolve(:interface))
29
- .print!
43
+ print_help(false)
30
44
 
31
45
  Tr3llo::Controller.new.start
@@ -1,13 +1,18 @@
1
1
  module Tr3llo
2
2
  module Presenter
3
3
  class HelpPresenter
4
- def initialize(interface)
4
+ def initialize(interface, stripped = false)
5
5
  @interface = interface
6
+ @stripped = stripped
6
7
  end
7
8
 
8
9
  def print!
9
10
  interface.print_frame do
10
- interface.puts menu_text
11
+ text = menu_text(@stripped)
12
+ if @stripped
13
+ text = text.split("\n").map(&:lstrip).drop(1).join("\n")
14
+ end
15
+ interface.puts text
11
16
  end
12
17
  end
13
18
 
@@ -15,10 +20,16 @@ module Tr3llo
15
20
 
16
21
  attr_reader :interface
17
22
 
18
- def menu_text
19
- %q{
23
+ def menu_text(cli_help = false)
24
+ cli_help_text = %q{
25
+ This is an interactive program for trello cards. To start, you
26
+ need to set `TRELLO_USER`, `TRELL_KEY` and `TRELLO_TOKEN` to access
27
+ your account. After that, the following commands are available in interactive
28
+ mode:
29
+ }
30
+ %Q{
20
31
  3llo - CLI for Trello
21
-
32
+ #{if cli_help then cli_help_text end}
22
33
  Usage:
23
34
  board list - Show list of board
24
35
  board select - Select board
@@ -1,3 +1,3 @@
1
1
  module Tr3llo
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: 3llo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cẩm Huỳnh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-06 00:00:00.000000000 Z
11
+ date: 2019-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-prompt
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  version: '0'
133
133
  requirements: []
134
134
  rubyforge_project:
135
- rubygems_version: 2.5.2
135
+ rubygems_version: 2.7.6
136
136
  signing_key:
137
137
  specification_version: 4
138
138
  summary: Trello CLI