Skip to content

Commit cb882a4

Browse files
committed
fix: Fixed the problem with project list feature
1 parent 7c177eb commit cb882a4

File tree

6 files changed

+28
-3
lines changed

6 files changed

+28
-3
lines changed

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ RuboCop::RakeTask.new
1515

1616
desc 'Run Cucumber features'
1717
task :cucumber do
18-
sh 'cucumber --format pretty'
18+
sh 'bundle exec cucumber --format pretty'
1919
end
2020

2121
task default: %i[rubocop test cucumber]

features/project_list.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Feature: Project List
55

66
Scenario: Listing my projects
77
When I run `lc project list --mine`
8-
Then the output should match /[\w-]+/
8+
Then the output should match /Crying Game/
99

1010
Scenario: Listing all projects
1111
When I run `lc project list`
12-
Then the output should match /[\w-]+/
12+
Then the output should match /Crying Game/

lib/linear/commands/project/list.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
require 'semantic_logger'
44

55
module Rubyists
6+
# Main module for Linear CLI commands
67
module Linear
8+
M :project
9+
O 'project/list'
710
module CLI
811
module Project
912
List = Class.new Dry::CLI::Command

lib/linear/models/project.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ def to_s
5353
def inspection
5454
format('name: "%<name>s" type: "%<url>s"', name:, url:)
5555
end
56+
57+
def display(_options)
58+
printf "%s\n", to_s
59+
end
5660
end
5761
end
5862
end

lib/linear/models/team.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,23 @@ class Team
1212
include SemanticLogger::Loggable
1313

1414
one_to_many :projects
15+
alias loaded_projects projects
16+
17+
def projects # rubocop:disable Metrics/MethodLength
18+
return @projects if @projects
19+
return @projects = loaded_projects if loaded_projects
20+
21+
team_id = data[:id]
22+
q = query do
23+
team(id: team_id) do
24+
projects(first: 100) do
25+
nodes { ___ Project.base_fragment }
26+
end
27+
end
28+
end
29+
data = Api.query(q)
30+
@projects = data.dig(:team, :projects, :nodes)&.map { |project| Project.new project } || []
31+
end
1532

1633
# TODO: Make this configurable
1734
BaseFilter = { # rubocop:disable Naming/ConstantName

linear-cli.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Gem::Specification.new do |spec|
4040
spec.add_dependency 'git'
4141
spec.add_dependency 'gqli'
4242
spec.add_dependency 'httpx'
43+
spec.add_dependency 'ostruct'
4344
spec.add_dependency 'pry-byebug'
4445
spec.add_dependency 'reline'
4546
spec.add_dependency 'semantic_logger'

0 commit comments

Comments
 (0)