gissuel 0.1.0 β†’ 0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 86dc4ddf433f59719b39b7e7d81dd558268760e0
4
- data.tar.gz: ee232b65e1eb79b9321d1155e19b300ab0077403
3
+ metadata.gz: 9b8ae9a9e88750a98dc714427e6ce5b254a43305
4
+ data.tar.gz: 4ff0835baa845c98c75c0343d18ba9091e536423
5
5
  SHA512:
6
- metadata.gz: 33fa8aa53d6081f8398d199fef6b0d22b40547ad2f85e199e03f73646068486c9a2e727661b511792f10f6a51774567d2f8b6107bab620cc2d2b966967a91a64
7
- data.tar.gz: 7360b877ca3493b113b464aaf84eeaf489317f10c8b2db8f0c920f9a4fc724baf0f37322b7acac94f39abc79143e50758ac8f82d5c8e1e075c2cb0a9c54d48b1
6
+ metadata.gz: 4d38500baacf8944f8856e9768ea98c277e475ba3863055abde68b5b2c095b7ff461ab8a4c80772a336f8bb1d352d2307feebf49d98f41e0fca67439316cbac2
7
+ data.tar.gz: 4737da86e70614a517ebc4874219e56e582b5708ec90531bc328cce994051f206b8b484755763e58d6a44dbe87c2410e9b948ed6b907c7635b2494dd3d9ca955
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]`
13
+ - Run `gissuel get --label [label] --repo [repo-name] --body`
14
14
 
15
15
  For example, I added lines similar to the following to my `.zshrc` file
16
16
 
@@ -18,4 +18,10 @@ Gissuel
18
18
  export GITHUB_TOKEN="XXXXXXXXXXXXX"
19
19
  gissuel planned semaphoreci/semaphore
20
20
  ```
21
- - Options `--label` and `--repo` are optional
21
+ - Options are optional
22
+ - `--repo` (`--label`) - When not specified, Gissuel will look for any issue
23
+ 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
+ each found issue
26
+ - `--index` - combined with above mentioned options, it will print only the issue
27
+ under the specified ordinal number
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
4
+ attr_reader :label, :repo, :body, :index
5
5
 
6
6
  desc "get", "will print out list of issues assigned to you"
7
7
 
@@ -17,11 +17,15 @@ module Gissuel
17
17
 
18
18
  option :label
19
19
  option :repo
20
+ option :body, :lazy_default => true, :default => false, :type => :boolean
21
+ option :index, :default => 0, :type => :numeric
20
22
  def get
21
23
  @label = options[:label]
22
- @repo = options[:repo]
24
+ @repo = options[:repo]
25
+ @body = options[:body]
26
+ @index = options[:index]
23
27
 
24
- Gissuel::Issues.new(label, repo).publish
28
+ Gissuel::Issues.new(label, repo, body, index).publish
25
29
  end
26
30
 
27
31
  desc "version", "Prints the haskii version info"
@@ -3,14 +3,16 @@ module Gissuel
3
3
 
4
4
  TOKEN = ENV["GITHUB_TOKEN"]
5
5
 
6
- def initialize(label, repo)
6
+ def initialize(label, repo, body, index)
7
7
  @label = label
8
8
  @repo = repo
9
9
  @state = "open"
10
+ @body = body
11
+ @index = index
10
12
  end
11
13
 
12
14
  def publish
13
- handle_gh_response(assigned_issues)
15
+ handle_issues(desired_issues)
14
16
  end
15
17
 
16
18
  private
@@ -24,8 +26,8 @@ module Gissuel
24
26
  client.user.login
25
27
  end
26
28
 
27
- def assigned_issues
28
- client.list_issues(
29
+ def desired_issues
30
+ issues = client.list_issues(
29
31
  @repo,
30
32
  options = {
31
33
  :assignee => my_login,
@@ -33,31 +35,36 @@ module Gissuel
33
35
  :state => @state
34
36
  }
35
37
  )
38
+
39
+ @index.zero? ? issues : [issues[@index - 1]]
36
40
  end
37
41
 
38
- def handle_gh_response(issues)
42
+ def handle_issues(issues)
39
43
  case issues.count
40
44
  when 0
41
45
  Gissuel::Log.new("\nGissuel: πŸ‘‹ β˜• ☺️").grey
42
46
  when 1
43
- Gissuel::Log.new("πŸ‘‹ there is one issue on your 🍽️.").red
44
- Gissuel::Log.new("β˜• here is quick look at it:\n").grey
45
-
46
- report_issue(issues[0])
47
+ if @index.zero? then
48
+ Gissuel::Log.new("πŸ‘‹ there is one issue on your 🍽️.").red
49
+ Gissuel::Log.new("β˜• here is quick look at it:\n").grey
50
+ else
51
+ Gissuel::Log.new("β˜• here is quick look at the issue:\n").grey
52
+ end
53
+ report_issue(issues.first, @index)
47
54
  else
48
55
  Gissuel::Log.new("πŸ‘‹ there are #{issues.count} issues on your 🍽️.").red
49
56
  Gissuel::Log.new("β˜• here is quick look at these:\n").grey
50
57
 
51
- issues.each do |i|
52
- report_issue(i)
58
+ issues.each_with_index do |issue, index|
59
+ report_issue(issue, index + 1)
53
60
  end
54
61
  end
55
62
  end
56
63
 
57
- def report_issue(issue)
58
- Gissuel::Log.new("TITLE: #{issue.title}").yellow
64
+ def report_issue(issue, index)
65
+ Gissuel::Log.new("[#{index}]: #{issue.title}").yellow
59
66
  Gissuel::Log.new("URL: #{issue.html_url}").blue
60
- Gissuel::Log.new("BODY: #{issue.body}").grey
67
+ Gissuel::Log.new("BODY: #{issue.body}").grey if @body
61
68
  Gissuel::Log.new("No of comments: #{issue.comments} | Updated at: #{issue.updated_at}\n").green
62
69
  end
63
70
 
@@ -1,3 +1,3 @@
1
1
  module Gissuel
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gissuel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Milana