linear-cli 0.9.1 → 0.9.3

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: f1cbd7a5da27f04067aa33ea976feceacb897b58872e88450e53e059aa4da61a
4
- data.tar.gz: 47dcf32313f84de194e8faf27de087344700225975cd88cce079acaf13a5dc89
3
+ metadata.gz: 5da1640ef734d4c0d3ed5ce059e80041a6808cef50ae9e2921b2bc19da92801e
4
+ data.tar.gz: 32909d592219559b20c96c2ee5c6ab28d02814c0ffd8b96c2ef443277f00b988
5
5
  SHA512:
6
- metadata.gz: a2a0d491b9ff5e1af1b3f76ae500766c65f63866986394d824e22debf4a56a70c5f530009d271dc90d882df0a508801c5bbbfbf0ef1c20869812c63fc49257e8
7
- data.tar.gz: de285eca24908a3c9ff7d227fb42d6ebbab5fd0be458490c9387a6fb8f4a5b11370cd8b1c281aae488924f888b608c698996a150d26691b4f3b64cbc20b69f2e
6
+ metadata.gz: '02380bc10cd1f815c4d2b70e7ed758ff3d295cf201658657ceba8ec17e309515534028745badaf96ffccd7799ddcd17907cfafb5de26d859da42e85bd1748c06'
7
+ data.tar.gz: 53213093b700258f122730864dfab5adaadd049eecbd7c2cb2bd13ebe2491e06f4db775c7a5515f977155ebfa07d0e9dbeafe6b0e0b37a8859dcc96627d52cdf
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.9.3] - 2024-02-07
6
+ ### Fixed
7
+ - Fixed probblem with tempfile for editing operations (@bougyman)
8
+
5
9
  ## [0.9.1] - 2024-02-06
6
10
  ### Fixed
7
11
  - Fixed wrapper to be more normal about help when listing leaf commands (@bougyman)
@@ -75,8 +79,9 @@
75
79
  ### Added
76
80
  - Added new changelog management system (changelog-rb) (@bougyman)
77
81
 
78
- [Unreleased]: https://github.com/rubyists/linear-cli/compare/0.9.1...HEAD
79
- [0.9.1]: https://github.com/rubyists/linear-cli/compare/v0.9.0...0.9.1
82
+ [Unreleased]: https://github.com/rubyists/linear-cli/compare/0.9.3...HEAD
83
+ [0.9.3]: https://github.com/rubyists/linear-cli/compare/v0.9.1...0.9.3
84
+ [0.9.1]: https://github.com/rubyists/linear-cli/compare/v0.9.0...v0.9.1
80
85
  [0.9.0]: https://github.com/rubyists/linear-cli/compare/v0.8.6...v0.9.0
81
86
  [0.8.6]: https://github.com/rubyists/linear-cli/compare/v0.8.4...v0.8.6
82
87
  [0.8.4]: https://github.com/rubyists/linear-cli/compare/v0.8.1...v0.8.4
@@ -0,0 +1,4 @@
1
+ type: Fixed
2
+ title: >
3
+ Fixed probblem with tempfile for editing operations
4
+ author: bougyman
@@ -0,0 +1 @@
1
+ date: 2024-02-07
data/exe/scripts/lc.sh CHANGED
@@ -21,7 +21,10 @@ then
21
21
  fi
22
22
  linear-cli "$@"
23
23
  result=$?
24
- if [ $result -gt 1 ]; then
24
+ if [ $result -eq 1 ]; then
25
+ printf "\nlc: You may pass --help for further information on any subcommand\n" >&2
26
+ exit 1
27
+ elif [ $result -gt 1 ]; then
25
28
  if [ $result -eq 130 ]; then
26
29
  printf "\n\nlc: linear-cli interrupted\n" >&2
27
30
  exit 130
@@ -4,6 +4,6 @@ then
4
4
  printf "This wrapper adds the --close option to the 'issue update' command.\n" >&2
5
5
  printf "It is used to close one or many issues. The issues are specified by their ID/slugs.\n" >&2
6
6
  printf "For closing multiple issues, you really want to pass --reason so you do not get prompted for each issue.\n\n" >&2
7
- exec linear-cli issue update --help
7
+ exec lc issue update --close --help
8
8
  fi
9
- exec linear-cli issue update --close "$@"
9
+ exec lc issue update --close "$@"
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bash
2
- exec linear-cli issue create "$@"
2
+ exec lc issue create "$@"
@@ -21,10 +21,6 @@ module Rubyists
21
21
  end
22
22
 
23
23
  def choose_a_team!(teams)
24
- prompt.on(:keypress) do |event|
25
- prompt.trigger(:keydown) if event.value == 'j'
26
- prompt.trigger(:keyup) if event.value == 'k'
27
- end
28
24
  key = prompt.select('Choose a team', teams.to_h { |t| [t.name, t.key] })
29
25
  Rubyists::Linear::Team.find key
30
26
  end
@@ -50,6 +46,10 @@ module Rubyists
50
46
  git.current_branch
51
47
  end
52
48
 
49
+ def branch_for(branch_name)
50
+ git.branches.local.detect { |b| b.name == branch_name } || git.branch(branch_name)
51
+ end
52
+
53
53
  # Horrible way to do this, but it is working for now
54
54
  def pull_or_push_new_branch!(branch_name)
55
55
  git.pull
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rubyists
4
4
  module Linear
5
- VERSION = '0.9.1'
5
+ VERSION = '0.9.3'
6
6
  end
7
7
  end
@@ -51,7 +51,7 @@ module Rubyists
51
51
  answer = prompt.ask("#{question}: ('-' to open an editor)", default: '-')
52
52
  return answer unless answer == '-'
53
53
 
54
- answer = editor_for [thing, '.md']
54
+ answer = editor_for [question.downcase, '.md']
55
55
  raise SmellsBad, "No content provided for #{question}" if answer.empty?
56
56
 
57
57
  answer
@@ -78,11 +78,11 @@ module Rubyists
78
78
  projects.select { |p| p.match_score?(search_term).positive? }.sort_by { |p| p.match_score?(search_term) }
79
79
  end
80
80
 
81
- def project_for(team, project = nil)
81
+ def project_for(team, project = nil) # rubocop:disable Metrics/AbcSize
82
82
  projects = team.projects
83
83
  return nil if projects.empty?
84
84
 
85
- possibles = project_scores(projects, project)
85
+ possibles = project ? project_scores(projects, project) : []
86
86
  return ask_for_projects(projects, search: project) if possibles.empty?
87
87
 
88
88
  first = possibles.first
data/lib/linear/cli.rb CHANGED
@@ -24,6 +24,7 @@ module Dry
24
24
  out.puts Completely::Completions.new(
25
25
  Input.new(@registry, @program_name).call(include_aliases:)
26
26
  ).script
27
+ # Here is the only change in our monkeypatch! Lame, right?
27
28
  out.puts 'complete -F _linear-cli_completions lc'
28
29
  out.string
29
30
  end
@@ -44,6 +45,7 @@ module Rubyists
44
45
  return @prompt if @prompt
45
46
 
46
47
  @prompt = TTY::Prompt.new
48
+ # This gives ex/vim style navigation to menus
47
49
  @prompt.on(:keypress) do |event|
48
50
  @prompt.trigger(:keydown) if event.value == 'j'
49
51
  @prompt.trigger(:keyup) if event.value == 'k'
@@ -92,8 +94,8 @@ module Rubyists
92
94
  module Linear
93
95
  # Open this back up to register 3rd party/other commands
94
96
  module CLI
95
- register 'completion', Dry::CLI::Completion::Command[self]
96
97
  # NOTE: We have monkeypatched the Generator to add our 'lc' alias
98
+ register 'completion', Dry::CLI::Completion::Command[self]
97
99
  end
98
100
  end
99
101
  end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'gqli'
4
+
5
+ module Rubyists
6
+ # Namespace for Linear
7
+ module Linear
8
+ M :base_model
9
+ Comment = Class.new(BaseModel)
10
+ # The Comment class represents a Linear issue comment.
11
+ class Comment
12
+ include SemanticLogger::Loggable
13
+
14
+ Base = fragment('BaseComment', 'Comment') do
15
+ id
16
+ body
17
+ url
18
+ createdAt
19
+ updatedAt
20
+ end
21
+
22
+ def to_s
23
+ format('%<id>-12s %<url>s', id:, url:)
24
+ end
25
+
26
+ def inspection
27
+ format('id: "%<id>s" url: "%<url>s"', id:, url:)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -3,7 +3,7 @@
3
3
  module Rubyists
4
4
  # Namespace for Linear
5
5
  module Linear
6
- M :user, :team
6
+ M :user, :team, :comment
7
7
  # The Issue class represents a Linear issue.
8
8
  class Issue
9
9
  # Class methods for Issue
@@ -21,6 +21,7 @@ module Rubyists
21
21
  ___ Base
22
22
  assignee { ___ User.full_fragment }
23
23
  team { ___ Team.full_fragment }
24
+ comments { nodes { ___ Comment.base_fragment } }
24
25
  end
25
26
  end
26
27
 
@@ -13,7 +13,8 @@ module Rubyists
13
13
  include SemanticLogger::Loggable
14
14
  extend ClassMethods
15
15
  many_to_one :assignee, :User
16
- many_to_one :team, :Team
16
+ many_to_one :team
17
+ one_to_many :comments
17
18
 
18
19
  BASIC_FILTER = { completedAt: { null: true } }.freeze
19
20
 
@@ -117,9 +118,17 @@ module Rubyists
117
118
  "Description was unparsable: #{description}\n"
118
119
  end
119
120
 
121
+ def display_comments
122
+ comments.map { |c| "--- #{c.createdAt} ---\n#{TTY::Markdown.parse(c.body)}" }.join("\n")
123
+ end
124
+
120
125
  def full
121
126
  sep = '-' * to_s.length
122
- format("%<to_s>s\n%<sep>s\n%<description>s\n", sep:, to_s:, description: parsed_description)
127
+ format("%<to_s>s\n%<sep>s\n%<description>s\n%<comments>s",
128
+ sep:,
129
+ to_s:,
130
+ description: parsed_description,
131
+ comments: display_comments)
123
132
  end
124
133
 
125
134
  def display(options)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linear-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tj (bougyman) Vanderpoel
@@ -246,6 +246,8 @@ files:
246
246
  - changelog/0.9.0/tag.yml
247
247
  - changelog/0.9.1/fixed_wrapper_to_be_more_normal_about_help_when_listing_leaf_commands.yml
248
248
  - changelog/0.9.1/tag.yml
249
+ - changelog/0.9.3/fixed_probblem_with_tempfile_for_editing_operations.yml
250
+ - changelog/0.9.3/tag.yml
249
251
  - changelog/unreleased/.gitkeep
250
252
  - cinemas/listings.cinema
251
253
  - cinemas/listings.cinema.gif
@@ -285,6 +287,7 @@ files:
285
287
  - lib/linear/models/base_model.rb
286
288
  - lib/linear/models/base_model/class_methods.rb
287
289
  - lib/linear/models/base_model/method_magic.rb
290
+ - lib/linear/models/comment.rb
288
291
  - lib/linear/models/issue.rb
289
292
  - lib/linear/models/issue/class_methods.rb
290
293
  - lib/linear/models/label.rb