gissuel 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9b8ae9a9e88750a98dc714427e6ce5b254a43305
4
- data.tar.gz: 4ff0835baa845c98c75c0343d18ba9091e536423
3
+ metadata.gz: 4e2dfe162a1416ab157dd9f0edae53dd1dc51217
4
+ data.tar.gz: 48cc405516f8af5d5d1df453c17bce42cfe1bafd
5
5
  SHA512:
6
- metadata.gz: 4d38500baacf8944f8856e9768ea98c277e475ba3863055abde68b5b2c095b7ff461ab8a4c80772a336f8bb1d352d2307feebf49d98f41e0fca67439316cbac2
7
- data.tar.gz: 4737da86e70614a517ebc4874219e56e582b5708ec90531bc328cce994051f206b8b484755763e58d6a44dbe87c2410e9b948ed6b907c7635b2494dd3d9ca955
6
+ metadata.gz: 0f45a7e2c906f4d9fb40576f80e44e4754db85a42e6864fff78379718edbe5810db3631e62fd94164c38533ff06a2969123d06189c03b81c86bfe69f9951c347
7
+ data.tar.gz: e7eb7952e15defc8e70494af99a57c8f00f5b957c5d3ffdf9099f776353e6e84e2030b8c846e6f6199d098e5ffa52d99607fd6c9fe0e7354ecb10a1b540c5e64
data/README.md CHANGED
@@ -10,7 +10,7 @@ Gissuel
10
10
 
11
11
  ## Usage
12
12
 
13
- - Run `gissuel get --label [label] --repo [repo-name] --body`
13
+ - Run `gissuel get --label [label] --repo [repo-name] --verbose`
14
14
 
15
15
  For example, I added lines similar to the following to my `.zshrc` file
16
16
 
@@ -18,10 +18,31 @@ Gissuel
18
18
  export GITHUB_TOKEN="XXXXXXXXXXXXX"
19
19
  gissuel planned semaphoreci/semaphore
20
20
  ```
21
+
21
22
  - Options are optional
22
23
  - `--repo` (`--label`) - When not specified, Gissuel will look for any issue
23
24
  that is assigned to token owner. Otherwise, it will only look for specified repo (label).
24
- - `--body` - when Gissuel is called with this option, it will show text for
25
+ - `--verbose` - when Gissuel is called with this option, it will show text for
25
26
  each found issue
26
- - `--index` - combined with above mentioned options, it will print only the issue
27
+ - `--index` - combined with above mentioned options, it will print only an issue
27
28
  under the specified ordinal number
29
+
30
+ ## Examples
31
+
32
+
33
+ I want to get quick overview of issues assigned to me within `semaphoreci/semaphore` repo:
34
+ ```
35
+ gissuel get --repo semaphoreci/semaphore
36
+ ```
37
+ I want to list mine issues with label planned:
38
+ ```
39
+ gissuel get --label planned
40
+ ```
41
+ I'd like to take a quick look at all issues withing repo `semaphoreci/semaphore` with label `planned` assigned to me
42
+ ```
43
+ gissuel get --repo semaphoreci/semaphore --label planned
44
+ ```
45
+ Finally, from the last list, I'd like to see description of second issue
46
+ ```
47
+ gissuel get --repo semaphoreci/semaphore --label planned --index 2 --verbose
48
+ ```
data/lib/gissuel/cli.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Gissuel
2
2
 
3
3
  class CLI < Thor
4
- attr_reader :label, :repo, :body, :index
4
+ attr_reader :label, :repo, :verbose, :index
5
5
 
6
6
  desc "get", "will print out list of issues assigned to you"
7
7
 
@@ -17,15 +17,15 @@ module Gissuel
17
17
 
18
18
  option :label
19
19
  option :repo
20
- option :body, :lazy_default => true, :default => false, :type => :boolean
20
+ option :verbose, :lazy_default => true, :default => false, :type => :boolean
21
21
  option :index, :default => 0, :type => :numeric
22
22
  def get
23
23
  @label = options[:label]
24
24
  @repo = options[:repo]
25
- @body = options[:body]
25
+ @verbose = options[:verbose]
26
26
  @index = options[:index]
27
27
 
28
- Gissuel::Issues.new(label, repo, body, index).publish
28
+ Gissuel::Issues.new(label, repo, verbose, index).publish
29
29
  end
30
30
 
31
31
  desc "version", "Prints the haskii version info"
@@ -3,12 +3,12 @@ module Gissuel
3
3
 
4
4
  TOKEN = ENV["GITHUB_TOKEN"]
5
5
 
6
- def initialize(label, repo, body, index)
7
- @label = label
8
- @repo = repo
9
- @state = "open"
10
- @body = body
11
- @index = index
6
+ def initialize(label, repo, verbose, index)
7
+ @verbose = verbose
8
+ @label = label
9
+ @repo = repo
10
+ @state = "open"
11
+ @index = index
12
12
  end
13
13
 
14
14
  def publish
@@ -47,10 +47,11 @@ module Gissuel
47
47
  if @index.zero? then
48
48
  Gissuel::Log.new("👋 there is one issue on your 🍽️.").red
49
49
  Gissuel::Log.new("☕ here is quick look at it:\n").grey
50
+ report_issue(issues.first, @index + 1)
50
51
  else
51
52
  Gissuel::Log.new("☕ here is quick look at the issue:\n").grey
52
- end
53
53
  report_issue(issues.first, @index)
54
+ end
54
55
  else
55
56
  Gissuel::Log.new("👋 there are #{issues.count} issues on your 🍽️.").red
56
57
  Gissuel::Log.new("☕ here is quick look at these:\n").grey
@@ -64,8 +65,25 @@ module Gissuel
64
65
  def report_issue(issue, index)
65
66
  Gissuel::Log.new("[#{index}]: #{issue.title}").yellow
66
67
  Gissuel::Log.new("URL: #{issue.html_url}").blue
67
- Gissuel::Log.new("BODY: #{issue.body}").grey if @body
68
- Gissuel::Log.new("No of comments: #{issue.comments} | Updated at: #{issue.updated_at}\n").green
68
+ Gissuel::Log.new("DESCRIPTION: #{issue.body}").grey if @verbose
69
+ Gissuel::Log.new(comments_report(issue)).green
70
+ end
71
+
72
+ def comments_report(issue)
73
+ general_info = "No of comments: #{issue.comments} | Updated at: #{issue.updated_at}"
74
+
75
+ # comment_autor_requested? ? [general, comment_author(issue)].join(" | ") : general
76
+ issue.comments.nonzero? && @verbose ? [general_info, last_comment_author(issue)].join(" | ") : general_info
77
+ end
78
+
79
+ def last_comment_author(issue)
80
+ repo = issue.repository_url
81
+ .split("/")
82
+ .last(2)
83
+ .join("/")
84
+
85
+ client.issue_comments(repo, issue.number).last
86
+ .user.login
69
87
  end
70
88
 
71
89
  end
@@ -1,3 +1,3 @@
1
1
  module Gissuel
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gissuel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Milana
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-25 00:00:00.000000000 Z
11
+ date: 2018-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler