linear-cli 0.9.15 → 0.9.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e384895de5670e8600f587b560b7cb77b13c4da7d7b19adbd3adec2778548e9
4
- data.tar.gz: 7ac584363d69316d71772cc83204df1fc669db0406864fa8a310fde2f4456749
3
+ metadata.gz: fdfa5217a71c9c72e813abafa1d9b84173f7cc84fbba9346ade9ff9b9a4a656a
4
+ data.tar.gz: 306e2f48788f60e3f89b721bfa31116dc671897e57d6279f7de32cbb430f45b8
5
5
  SHA512:
6
- metadata.gz: 81a7a057d610800db4b3e5328229039f20f3756404cf0f1f00a835dbf8884284ec865a7cf401c6ceafaa5502dbc6a3a64e17f25c68a371ec6c3f0d38cc3746ab
7
- data.tar.gz: 295d105a6539b0c72d209c0e8bee07320311f6f1de9b4fe0f26857bc31786bd9d799d3be859918ef0aa1756411ea5c4b222ba93715d5a08957abb14300f0c30c
6
+ metadata.gz: e8a499e75976dd0877fa02d93b2f2a911b521633e917d702fad681e0e378e9d5b1fa0d79706b9fb54ecae910f32bd78dcfeb6c1c5fa6c5ff9bc63e3d601b90c4
7
+ data.tar.gz: 4967fc24d83629772911e084a4210c10bfa1dfb379fa56ca4e48df9f26e9dcbb700809f73a26b1001533e3fd893680cdb954acd5853c13369f302030c45e6847
data/CHANGELOG.md CHANGED
@@ -107,8 +107,8 @@
107
107
  ### Added
108
108
  - Added new changelog management system (changelog-rb) (@bougyman)
109
109
 
110
- [Unreleased]: https://github.com/rubyists/linear-cli/compare/0.9.11...HEAD
111
- [0.9.11]: https://github.com/rubyists/linear-cli/compare/v0.9.10...0.9.11
110
+ [Unreleased]: https://github.com/rubyists/linear-cli/compare/v0.9.11...HEAD
111
+ [0.9.11]: https://github.com/rubyists/linear-cli/compare/v0.9.10...v0.9.11
112
112
  [0.9.10]: https://github.com/rubyists/linear-cli/compare/0.9.8...v0.9.10
113
113
  [0.9.8]: https://github.com/rubyists/linear-cli/compare/v0.9.7...0.9.8
114
114
  [0.9.7]: https://github.com/rubyists/linear-cli/compare/v0.9.5...v0.9.7
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rubyists
4
4
  module Linear
5
- VERSION = '0.9.15'
5
+ VERSION = '0.9.18'
6
6
  end
7
7
  end
@@ -27,6 +27,7 @@ module Rubyists
27
27
  argument :ids, type: :array, default: [], desc: 'Issue IDs to list'
28
28
  option :mine, type: :boolean, default: true, desc: 'Only show my issues'
29
29
  option :unassigned, aliases: ['-u'], type: :boolean, default: false, desc: 'Show unassigned issues only'
30
+ option :team, aliases: ['-t'], type: :string, desc: 'Show issues for only this team'
30
31
  option :full, type: :boolean, aliases: ['-f'], default: false, desc: 'Show full issue details'
31
32
 
32
33
  def call(ids:, **options)
@@ -36,13 +37,19 @@ module Rubyists
36
37
  display issues_for(options.merge(ids:)), options
37
38
  end
38
39
 
40
+ def filters_for(options)
41
+ filter = {}
42
+ filter[:assignee] = { isMe: { eq: true } } if options[:mine]
43
+ filter[:assignee] = { null: true } if options[:unassigned]
44
+ filter[:team] = { key: { eq: options[:team] } } if options[:team]
45
+ filter
46
+ end
47
+
39
48
  def issues_for(options)
40
49
  logger.debug('Fetching issues', options:)
41
50
  return options[:ids].map { |id| Rubyists::Linear::Issue.find(id.upcase) } if options[:ids]
42
- return Rubyists::Linear::Issue.all(filter: { assignee: { null: true } }) if options[:unassigned]
43
- return Rubyists::Linear::User.me.issues if options[:mine]
44
51
 
45
- Rubyists::Linear::Issue.all
52
+ Rubyists::Linear::Issue.all filter: filters_for(options)
46
53
  end
47
54
  end
48
55
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'semantic_logger'
4
+ require_relative '../issue'
4
5
 
5
6
  module Rubyists
6
7
  # Namespace for Linear
@@ -14,6 +15,7 @@ module Rubyists
14
15
  class Take
15
16
  include SemanticLogger::Loggable
16
17
  include Rubyists::Linear::CLI::CommonOptions
18
+ include Rubyists::Linear::CLI::Issue # for #gimme_da_issue! and other Issue methods
17
19
  desc 'Assign one or more issues to yourself'
18
20
  argument :issue_ids, type: :array, required: true, desc: 'Issue Identifiers'
19
21
 
@@ -36,7 +36,7 @@ module Rubyists
36
36
  def cancel_issue(issue, **options)
37
37
  reason = reason_for(options[:reason], four: "cancelling #{issue.identifier} - #{issue.title}")
38
38
  issue_comment issue, reason
39
- cancel_state = cancel_state_for(issue)
39
+ cancel_state = cancelled_state_for(issue)
40
40
  issue.close! state: cancel_state, trash: options[:trash]
41
41
  prompt.ok "#{issue.identifier} was cancelled"
42
42
  end
@@ -70,9 +70,10 @@ module Rubyists
70
70
  prompt.ok "#{issue.identifier} was attached to #{project.name}"
71
71
  end
72
72
 
73
- def update_issue(issue, **options)
73
+ def update_issue(issue, **options) # rubocop:disable Metrics/AbcSize
74
74
  issue_comment(issue, options[:comment]) if options[:comment]
75
75
  return close_issue(issue, **options) if options[:close]
76
+ return cancel_issue(issue, **options) if options[:cancel]
76
77
  return issue_pr(issue) if options[:pr]
77
78
  return attach_project(issue, options[:project]) if options[:project]
78
79
  return if options[:comment]
@@ -66,16 +66,22 @@ module Rubyists
66
66
  def close_mutation(close_state, trash: false)
67
67
  id_for_this = identifier
68
68
  input = { stateId: close_state.id }
69
- input[:trash] = true if trash
69
+ input[:trashed] = true if trash
70
70
  mutation { issueUpdate(id: id_for_this, input:) { issue { ___ Issue.full_fragment } } }
71
71
  end
72
72
 
73
- def close!(state: nil, trash: false)
73
+ def close!(state: nil, trash: false) # rubocop:disable Metrics/MethodLength
74
74
  logger.warn "Using first completed state found: #{completed_states.first}" if state.nil?
75
75
  state ||= completed_states.first
76
76
  query_data = Api.query close_mutation(state, trash:)
77
+ unless query_data.respond_to?(:dig)
78
+ raise SmellsBad, "Unknown response (#{query_data || "NULL"}) updating #{self} to #{state}, trash: #{trash}"
79
+ end
80
+
77
81
  updated = query_data.dig(:issueUpdate, :issue)
78
- raise SmellsBad, "Unknown response for issue close: #{data} (should have :issueUpdate key)" if updated.nil?
82
+ if updated.nil?
83
+ raise SmellsBad, "Unknown response for issue close: #{query_data} (should have :issueUpdate key)"
84
+ end
79
85
 
80
86
  @data = @updated_data = updated
81
87
  self
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linear-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.15
4
+ version: 0.9.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tj (bougyman) Vanderpoel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-08 00:00:00.000000000 Z
11
+ date: 2024-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -257,7 +257,6 @@ files:
257
257
  - lib/linear/models/user.rb
258
258
  - lib/linear/models/workflow_state.rb
259
259
  - lib/linear/version.rb
260
- - linear-cli.gemspec
261
260
  - oci/Containerfile
262
261
  - oci/build_image
263
262
  - oci/plc
data/linear-cli.gemspec DELETED
@@ -1,54 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'lib/linear/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'linear-cli'
7
- spec.version = Rubyists::Linear::VERSION
8
- spec.authors = ['Tj (bougyman) Vanderpoel']
9
- spec.email = ['tj@rubyists.com']
10
-
11
- spec.summary = 'CLI for interacting with Linear.app.'
12
- spec.description = 'A CLI for interacting with Linear.app. Loosely based on the GitHub CLI'
13
- spec.homepage = 'https://github.com/rubyists/linear-cli'
14
- spec.required_ruby_version = '>= 3.2.0'
15
-
16
- spec.license = 'MIT'
17
- spec.metadata['allowed_push_host'] = 'https://rubygems.org'
18
-
19
- spec.metadata['homepage_uri'] = spec.homepage
20
- spec.metadata['source_code_uri'] = spec.homepage
21
- spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/master/CHANGELOG.md"
22
-
23
- # Specify which files should be added to the gem when it is released.
24
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
- spec.files = Dir.chdir(__dir__) do
26
- `git ls-files -z`.split("\x0").reject do |f|
27
- (File.expand_path(f) == __FILE__) ||
28
- f.start_with?(*%w[changelog/ pkg/ bin/ test/ spec/ features/ .git .github appveyor .rspec .rubocop cucumber.yml
29
- Gemfile])
30
- end
31
- end
32
- spec.bindir = 'exe'
33
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }.reject { |f| f.end_with?('.sh') }
34
- spec.require_paths = ['lib']
35
-
36
- # Uncomment to register a new dependency of your gem
37
- spec.add_dependency 'base64', '~> 0.2'
38
- spec.add_dependency 'dry-cli', '~> 1.0'
39
- spec.add_dependency 'dry-cli-completion', '~> 1.0'
40
- spec.add_dependency 'git', '~> 1.5'
41
- spec.add_dependency 'gqli', '~> 1.2'
42
- spec.add_dependency 'httpx', '~> 1.2'
43
- spec.add_dependency 'pry-byebug'
44
- spec.add_dependency 'semantic_logger', '~> 4.0'
45
- spec.add_dependency 'sequel', '~> 5.0'
46
- spec.add_dependency 'sqlite3', '~> 1.7'
47
- spec.add_dependency 'tty-editor', '~> 0.7'
48
- spec.add_dependency 'tty-markdown', '~> 0.7'
49
- spec.add_dependency 'tty-prompt', '~> 0.23'
50
-
51
- # For more information and examples about making a new gem, check out our
52
- # guide at: https://bundler.io/guides/creating_gem.html
53
- spec.metadata['rubygems_mfa_required'] = 'true'
54
- end