checkoff 0.273.0 → 0.275.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
  SHA256:
3
- metadata.gz: 7fea08809439c2f9132a8c73676b75ff3ab0505f36f3036f33ec6e2c862f20c2
4
- data.tar.gz: b0eabb13cfcacdf9490718c559c18bf0934ab8d25af602f7b7c30c427d36a9ee
3
+ metadata.gz: 0d1a98ed83f3d39bf0fa6c4fac31b5b123d7a46220b164251d76f6b3cf6408df
4
+ data.tar.gz: 76da86f40184b64c0b2056ffe40ddf0417f6b6510134884dce46413a122cd539
5
5
  SHA512:
6
- metadata.gz: bb178435b4e1bd9269385f90bafcde91216cc5d06af6332c03e843c1e196847fd693f4f7f4e3e079a3a9110e1b7cd195ba730109f151b106ff25b37fb1b10bd7
7
- data.tar.gz: c2dbb835e30187e6629eea5ee78f56921d9ccc8045b8a65b975ac5e4c4cd89fcca37c7f17619d5a7e5c20177c2d953792c1de4c1bae18ad398870cdab9c9a081
6
+ metadata.gz: 75eb225b1f682bf8e03d203e62ba1904712eb24e977026e64aec086b83b9c0d8732088f3aeb6f82f16ea7d4568afdb155d6a4a319191c1cee6eb236eff370cc2
7
+ data.tar.gz: 8e243128c13d5fc13f5075a410531a70fa4c086f9436bf7f435dce9604c7b3419ddd48b0326b94ff4de5043b8d35655fe730719b74583eb0f0fcdbe600d1d540
@@ -187,15 +187,18 @@ module Checkoff
187
187
 
188
188
  # bundle exec ./attachments.rb
189
189
  class << self
190
+ # @param tasks_class [Class<Checkoff::Tasks>]
191
+ # @param attachments_class [Class<Checkoff::Attachments>]
192
+ #
190
193
  # @return [void]
191
- def run
194
+ def run(tasks_class: Checkoff::Tasks, attachments_class: Checkoff::Attachments)
192
195
  # @type [String]
193
196
  gid = ARGV[0] || raise('Please pass task gid as first argument')
194
197
  # @type [String]
195
198
  url = ARGV[1] || raise('Please pass attachment URL as second argument')
196
199
 
197
- tasks = Checkoff::Tasks.new
198
- attachments = Checkoff::Attachments.new
200
+ tasks = tasks_class.new
201
+ attachments = attachments_class.new
199
202
  task = tasks.task_by_gid(gid)
200
203
  raise "Could not find task #{gid}" if task.nil?
201
204
 
data/lib/checkoff/cli.rb CHANGED
@@ -297,10 +297,63 @@ module Checkoff
297
297
  attr_reader :workspace_name, :task_name
298
298
  end
299
299
 
300
+ # Builds the subcommands CheckoffGLIApp runs, giving the quickadd and
301
+ # view subcommands the collaborators they accept out of those passed
302
+ # here; the rest fall back to the subcommand's own defaults.
303
+ class SubcommandFactory
304
+ # @param mv_subcommand_class [Class<MvSubcommand>]
305
+ # @param collaborators [Hash{Symbol => Object}]
306
+ def initialize(mv_subcommand_class: MvSubcommand, **collaborators)
307
+ @mv_subcommand_class = mv_subcommand_class
308
+ @collaborators = collaborators
309
+ end
310
+
311
+ # @param workspace_name [String]
312
+ # @param task_name [String]
313
+ # @return [QuickaddSubcommand]
314
+ def quickadd(workspace_name, task_name)
315
+ QuickaddSubcommand.new(workspace_name, task_name,
316
+ **@collaborators.slice(:config, :workspaces, :tasks))
317
+ end
318
+
319
+ # @param workspace_name [String]
320
+ # @param project_name [String]
321
+ # @param section_name [String, nil]
322
+ # @param task_name [String, nil]
323
+ # @return [ViewSubcommand]
324
+ def view(workspace_name, project_name, section_name, task_name)
325
+ ViewSubcommand.new(workspace_name, project_name, section_name, task_name,
326
+ **@collaborators.slice(:config, :projects, :sections, :tasks, :stderr))
327
+ end
328
+
329
+ # @param from_workspace_arg [Symbol, String]
330
+ # @param from_project_arg [Symbol, String]
331
+ # @param from_section_arg [nil, String]
332
+ # @param to_workspace_arg [Symbol, String]
333
+ # @param to_project_arg [Symbol, String]
334
+ # @param to_section_arg [Symbol, String, nil]
335
+ # @return [MvSubcommand]
336
+ def mv(from_workspace_arg:, from_project_arg:, from_section_arg:,
337
+ to_workspace_arg:, to_project_arg:, to_section_arg:)
338
+ @mv_subcommand_class.new(from_workspace_arg:, from_project_arg:, from_section_arg:,
339
+ to_workspace_arg:, to_project_arg:, to_section_arg:)
340
+ end
341
+ end
342
+
300
343
  # Provide ability for CLI to pull Asana items
301
344
  class CheckoffGLIApp
302
345
  extend ::GLI::App
303
346
 
347
+ class << self
348
+ # @return [SubcommandFactory]
349
+ def subcommand_factory
350
+ @subcommand_factory ||= SubcommandFactory.new
351
+ end
352
+
353
+ # @return [SubcommandFactory, nil] nil restores the default
354
+ attr_writer :subcommand_factory
355
+ end
356
+
304
357
  program_desc 'Command-line client for Asana (unofficial)'
305
358
 
306
359
  subcommand_option_handling :normal
@@ -316,7 +369,7 @@ module Checkoff
316
369
  workspace_name = args.fetch(0)
317
370
  task_name = args.fetch(1)
318
371
 
319
- QuickaddSubcommand.new(workspace_name, task_name).run
372
+ subcommand_factory.quickadd(workspace_name, task_name).run
320
373
  end
321
374
  end
322
375
 
@@ -334,7 +387,7 @@ module Checkoff
334
387
  section_name = args[2]
335
388
  task_name = args[3]
336
389
 
337
- puts ViewSubcommand.new(workspace_name, project_name, section_name, task_name).run
390
+ puts subcommand_factory.view(workspace_name, project_name, section_name, task_name).run
338
391
  end
339
392
  end
340
393
 
@@ -375,12 +428,12 @@ module Checkoff
375
428
  to_workspace = options.fetch('to_workspace')
376
429
  to_project = options.fetch('to_project')
377
430
  to_section = options.fetch('to_section')
378
- MvSubcommand.new(from_workspace_arg: from_workspace,
379
- from_project_arg: from_project,
380
- from_section_arg: from_section,
381
- to_workspace_arg: to_workspace,
382
- to_project_arg: to_project,
383
- to_section_arg: to_section).run
431
+ subcommand_factory.mv(from_workspace_arg: from_workspace,
432
+ from_project_arg: from_project,
433
+ from_section_arg: from_section,
434
+ to_workspace_arg: to_workspace,
435
+ to_project_arg: to_project,
436
+ to_section_arg: to_section).run
384
437
  end
385
438
  end
386
439
  # rubocop:enable Metrics/BlockLength
@@ -12,10 +12,12 @@ module Checkoff
12
12
  # @param config [Hash{Symbol => undefined}]
13
13
  # @param sym [Symbol]
14
14
  # @param yaml_filename [String]
15
- def initialize(config, sym, yaml_filename)
15
+ # @param env [RBS::Unnamed::ENVClass, Hash{String => String}]
16
+ def initialize(config, sym, yaml_filename, env: ENV)
16
17
  @config = config
17
18
  @envvar_prefix = sym.upcase
18
19
  @yaml_filename = yaml_filename
20
+ @env = env
19
21
  end
20
22
 
21
23
  # @param key [Symbol]
@@ -24,7 +26,7 @@ module Checkoff
24
26
  config_value = @config[key]
25
27
  return config_value unless config_value.nil?
26
28
 
27
- ENV.fetch(envvar_name(key), nil)
29
+ @env.fetch(envvar_name(key), nil)
28
30
  end
29
31
 
30
32
  # @param key [Symbol]
@@ -50,19 +52,20 @@ module Checkoff
50
52
  class ConfigLoader
51
53
  class << self
52
54
  # @param sym [Symbol]
55
+ # @param filename [String]
56
+ # @param env [RBS::Unnamed::ENVClass, Hash{String => String}]
53
57
  #
54
58
  # @return [EnvFallbackConfigLoader]
55
- def load(sym)
56
- yaml_result = load_yaml_file(sym)
57
- EnvFallbackConfigLoader.new(yaml_result, sym, yaml_filename(sym))
59
+ def load(sym, filename: yaml_filename(sym), env: ENV)
60
+ yaml_result = load_yaml_file(filename)
61
+ EnvFallbackConfigLoader.new(yaml_result, sym, filename, env:)
58
62
  end
59
63
 
60
64
  private
61
65
 
62
- # @param sym [Symbol]
66
+ # @param filename [String]
63
67
  # @return [Hash{Symbol => undefined}]
64
- def load_yaml_file(sym)
65
- filename = yaml_filename(sym)
68
+ def load_yaml_file(filename)
66
69
  return {} unless File.exist?(filename)
67
70
 
68
71
  YAML.load_file(filename).with_indifferent_access
@@ -12,16 +12,19 @@ module Checkoff
12
12
  # @param tasks [Checkoff::Tasks]
13
13
  # @param timelines [Checkoff::Timelines]
14
14
  # @param custom_fields [Checkoff::CustomFields]
15
+ # @param time_class [Class<Time>]
15
16
  # @param _kwargs [Hash]
16
17
  def initialize(selector:,
17
18
  tasks:,
18
19
  timelines:,
19
20
  custom_fields:,
21
+ time_class: Time,
20
22
  **_kwargs)
21
23
  @selector = selector
22
24
  @tasks = tasks
23
25
  @timelines = timelines
24
26
  @custom_fields = custom_fields
27
+ @time_class = time_class
25
28
  super()
26
29
  end
27
30
 
@@ -34,6 +37,9 @@ module Checkoff
34
37
  # @return [Checkoff::CustomFields]
35
38
  attr_reader :custom_fields
36
39
 
40
+ # @return [Class<Time>]
41
+ attr_reader :time_class
42
+
37
43
  private
38
44
 
39
45
  # @return [Array<Symbol, Array>, Symbol, String]
@@ -244,7 +244,7 @@ module Checkoff
244
244
  return true if stories.empty? # no stories == infinitely old!
245
245
 
246
246
  last_story = stories.last
247
- n_days_ago = Time.at(Time.now.to_i - (num_days * 86_400))
247
+ n_days_ago = Time.at(time_class.now.to_i - (num_days * 86_400))
248
248
  # @sg-ignore https://github.com/apiology/solargraph/pull/175
249
249
  created_time(last_story) < n_days_ago
250
250
  end
@@ -12,14 +12,17 @@ module Checkoff
12
12
  # @param tasks [Checkoff::Tasks]
13
13
  # @param timelines [Checkoff::Timelines]
14
14
  # @param custom_fields [Checkoff::CustomFields]
15
+ # @param time_class [Class<Time>]
15
16
  def initialize(task:,
16
17
  tasks: Checkoff::Tasks.new,
17
18
  timelines: Checkoff::Timelines.new,
18
- custom_fields: Checkoff::CustomFields.new)
19
+ custom_fields: Checkoff::CustomFields.new,
20
+ time_class: Time)
19
21
  @item = task
20
22
  @tasks = tasks
21
23
  @timelines = timelines
22
24
  @custom_fields = custom_fields
25
+ @time_class = time_class
23
26
  super()
24
27
  end
25
28
 
@@ -45,7 +48,7 @@ module Checkoff
45
48
 
46
49
  # @return [Hash]
47
50
  def initializer_kwargs
48
- { tasks:, timelines:, custom_fields: }
51
+ { tasks:, timelines:, custom_fields:, time_class: }
49
52
  end
50
53
 
51
54
  # @return [Asana::Resources::Task]
@@ -56,5 +59,7 @@ module Checkoff
56
59
  attr_reader :timelines
57
60
  # @return [Checkoff::CustomFields]
58
61
  attr_reader :custom_fields
62
+ # @return [Class<Time>]
63
+ attr_reader :time_class
59
64
  end
60
65
  end
data/lib/checkoff/tags.rb CHANGED
@@ -33,14 +33,17 @@ module Checkoff
33
33
  # @param client [Asana::Client]
34
34
  # @param projects [Checkoff::Projects]
35
35
  # @param workspaces [Checkoff::Workspaces]
36
+ # @param asana_resources_collection_class [Class<Asana::Resources::Collection>]
36
37
  def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana),
37
38
  clients: Checkoff::Clients.new(config:),
38
39
  client: clients.client,
39
40
  projects: Checkoff::Projects.new(config:, client:),
40
- workspaces: Checkoff::Workspaces.new(config:, client:))
41
+ workspaces: Checkoff::Workspaces.new(config:, client:),
42
+ asana_resources_collection_class: Asana::Resources::Collection)
41
43
  @workspaces = T.let(workspaces, Checkoff::Workspaces)
42
44
  @projects = T.let(projects, Checkoff::Projects)
43
45
  @client = T.let(client, Asana::Client)
46
+ @asana_resources_collection_class = asana_resources_collection_class
44
47
  end
45
48
 
46
49
  # @param workspace_name [String]
@@ -69,10 +72,10 @@ module Checkoff
69
72
  options = projects.task_options(extra_fields:,
70
73
  only_uncompleted:)
71
74
  params = build_params(options)
72
- Asana::Resources::Collection.new(parse(client.get("/tags/#{tag_gid}/tasks",
73
- params:, options: options[:options])),
74
- type: Asana::Resources::Task,
75
- client:)
75
+ @asana_resources_collection_class.new(parse(client.get("/tags/#{tag_gid}/tasks",
76
+ params:, options: options[:options])),
77
+ type: Asana::Resources::Task,
78
+ client:)
76
79
  end
77
80
 
78
81
  # @param workspace_name [String]
@@ -25,6 +25,7 @@ module Checkoff
25
25
  # @param [Checkoff::Tasks] tasks
26
26
  # @param [Checkoff::Timelines] timelines
27
27
  # @param [Checkoff::CustomFields] custom_fields
28
+ # @param [Class<Time>] time_class
28
29
  def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana),
29
30
  client: Checkoff::Clients.new(config:).client,
30
31
  tasks: Checkoff::Tasks.new(config:,
@@ -32,11 +33,13 @@ module Checkoff
32
33
  timelines: Checkoff::Timelines.new(config:,
33
34
  client:),
34
35
  custom_fields: Checkoff::CustomFields.new(config:,
35
- client:))
36
+ client:),
37
+ time_class: Time)
36
38
  @config = config
37
39
  @tasks = tasks
38
40
  @timelines = timelines
39
41
  @custom_fields = custom_fields
42
+ @time_class = time_class
40
43
  end
41
44
 
42
45
  # @param [Asana::Resources::Task] task
@@ -45,7 +48,7 @@ module Checkoff
45
48
  # @return [Boolean]
46
49
  def filter_via_task_selector(task, task_selector)
47
50
  evaluator = TaskSelectorEvaluator.new(task:, tasks:, timelines:,
48
- custom_fields:)
51
+ custom_fields:, time_class: @time_class)
49
52
  !!evaluator.evaluate(task_selector)
50
53
  end
51
54
 
@@ -4,5 +4,5 @@
4
4
  # Command-line and gem client for Asana (unofficial)
5
5
  module Checkoff
6
6
  # Version of library
7
- VERSION = '0.273.0'
7
+ VERSION = '0.275.0'
8
8
  end
data/rbi/checkoff.rbi CHANGED
@@ -82,7 +82,7 @@ module Overcommit
82
82
  end
83
83
 
84
84
  module Checkoff
85
- VERSION = '0.273.0'
85
+ VERSION = '0.275.0'
86
86
 
87
87
  class Attachments
88
88
  include Logging
@@ -145,8 +145,8 @@ module Checkoff
145
145
  sig { returns(T.untyped) }
146
146
  attr_reader :client
147
147
 
148
- sig { returns(T.untyped) }
149
- def self.run; end
148
+ sig { params(tasks_class: T.untyped, attachments_class: T.untyped).returns(T.untyped) }
149
+ def self.run(tasks_class: Checkoff::Tasks, attachments_class: Checkoff::Attachments); end
150
150
  end
151
151
 
152
152
  class MvSubcommand
@@ -305,8 +305,46 @@ module Checkoff
305
305
  attr_reader :task_name
306
306
  end
307
307
 
308
+ class SubcommandFactory
309
+ sig { params(mv_subcommand_class: T.untyped, collaborators: T.untyped).void }
310
+ def initialize(mv_subcommand_class: MvSubcommand, **collaborators); end
311
+
312
+ sig { params(workspace_name: T.untyped, task_name: T.untyped).returns(T.untyped) }
313
+ def quickadd(workspace_name, task_name); end
314
+
315
+ sig do
316
+ params(
317
+ workspace_name: T.untyped,
318
+ project_name: T.untyped,
319
+ section_name: T.untyped,
320
+ task_name: T.untyped
321
+ ).returns(T.untyped)
322
+ end
323
+ def view(workspace_name, project_name, section_name, task_name); end
324
+
325
+ sig do
326
+ params(
327
+ from_workspace_arg: T.untyped,
328
+ from_project_arg: T.untyped,
329
+ from_section_arg: T.untyped,
330
+ to_workspace_arg: T.untyped,
331
+ to_project_arg: T.untyped,
332
+ to_section_arg: T.untyped
333
+ ).returns(T.untyped)
334
+ end
335
+ def mv(from_workspace_arg:, from_project_arg:, from_section_arg:, to_workspace_arg:, to_project_arg:, to_section_arg:); end
336
+ end
337
+
308
338
  class CheckoffGLIApp
309
339
  extend ::GLI::App
340
+
341
+ class << self
342
+ sig { params(subcommand_factory: T.untyped).returns(T.untyped) }
343
+ attr_writer :subcommand_factory
344
+ end
345
+
346
+ sig { returns(T.untyped) }
347
+ def self.subcommand_factory; end
310
348
  end
311
349
 
312
350
  class Clients
@@ -560,10 +598,11 @@ module Checkoff
560
598
  task: T.untyped,
561
599
  tasks: T.untyped,
562
600
  timelines: T.untyped,
563
- custom_fields: T.untyped
601
+ custom_fields: T.untyped,
602
+ time_class: T.untyped
564
603
  ).void
565
604
  end
566
- def initialize(task:, tasks: Checkoff::Tasks.new, timelines: Checkoff::Timelines.new, custom_fields: Checkoff::CustomFields.new); end
605
+ def initialize(task:, tasks: Checkoff::Tasks.new, timelines: Checkoff::Timelines.new, custom_fields: Checkoff::CustomFields.new, time_class: Time); end
567
606
 
568
607
  sig { returns(T.untyped) }
569
608
  def function_evaluators; end
@@ -582,6 +621,9 @@ module Checkoff
582
621
 
583
622
  sig { returns(T.untyped) }
584
623
  attr_reader :custom_fields
624
+
625
+ sig { returns(T.untyped) }
626
+ attr_reader :time_class
585
627
  end
586
628
 
587
629
  class MyTasks
@@ -1053,10 +1095,11 @@ module Checkoff
1053
1095
  clients: T.untyped,
1054
1096
  client: T.untyped,
1055
1097
  projects: T.untyped,
1056
- workspaces: T.untyped
1098
+ workspaces: T.untyped,
1099
+ asana_resources_collection_class: T.untyped
1057
1100
  ).void
1058
1101
  end
1059
- def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana), clients: Checkoff::Clients.new(config:), client: clients.client, projects: Checkoff::Projects.new(config:, client:), workspaces: Checkoff::Workspaces.new(config:, client:)); end
1102
+ def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana), clients: Checkoff::Clients.new(config:), client: clients.client, projects: Checkoff::Projects.new(config:, client:), workspaces: Checkoff::Workspaces.new(config:, client:), asana_resources_collection_class: Asana::Resources::Collection); end
1060
1103
 
1061
1104
  sig do
1062
1105
  params(
@@ -1183,13 +1226,14 @@ module Checkoff
1183
1226
  client: T.untyped,
1184
1227
  tasks: T.untyped,
1185
1228
  timelines: T.untyped,
1186
- custom_fields: T.untyped
1229
+ custom_fields: T.untyped,
1230
+ time_class: T.untyped
1187
1231
  ).void
1188
1232
  end
1189
1233
  def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana), client: Checkoff::Clients.new(config:).client, tasks: Checkoff::Tasks.new(config:,
1190
1234
  client:), timelines: Checkoff::Timelines.new(config:,
1191
1235
  client:), custom_fields: Checkoff::CustomFields.new(config:,
1192
- client:)); end
1236
+ client:), time_class: Time); end
1193
1237
 
1194
1238
  sig { params(task: T.untyped, task_selector: T.untyped).returns(T.untyped) }
1195
1239
  def filter_via_task_selector(task, task_selector); end
@@ -1582,8 +1626,15 @@ module Checkoff
1582
1626
  end
1583
1627
 
1584
1628
  class EnvFallbackConfigLoader
1585
- sig { params(config: T.untyped, sym: T.untyped, yaml_filename: T.untyped).void }
1586
- def initialize(config, sym, yaml_filename); end
1629
+ sig do
1630
+ params(
1631
+ config: T.untyped,
1632
+ sym: T.untyped,
1633
+ yaml_filename: T.untyped,
1634
+ env: T.untyped
1635
+ ).void
1636
+ end
1637
+ def initialize(config, sym, yaml_filename, env: ENV); end
1587
1638
 
1588
1639
  sig { params(key: T.untyped).returns(T.untyped) }
1589
1640
  def [](key); end
@@ -1596,11 +1647,11 @@ module Checkoff
1596
1647
  end
1597
1648
 
1598
1649
  class ConfigLoader
1599
- sig { params(sym: T.untyped).returns(T.untyped) }
1600
- def self.load(sym); end
1650
+ sig { params(sym: T.untyped, filename: T.untyped, env: T.untyped).returns(T.untyped) }
1651
+ def self.load(sym, filename: yaml_filename(sym), env: ENV); end
1601
1652
 
1602
- sig { params(sym: T.untyped).returns(T.untyped) }
1603
- def self.load_yaml_file(sym); end
1653
+ sig { params(filename: T.untyped).returns(T.untyped) }
1654
+ def self.load_yaml_file(filename); end
1604
1655
 
1605
1656
  sig { params(sym: T.untyped).returns(T.untyped) }
1606
1657
  def self.yaml_filename(sym); end
@@ -2494,10 +2545,11 @@ module Checkoff
2494
2545
  tasks: T.untyped,
2495
2546
  timelines: T.untyped,
2496
2547
  custom_fields: T.untyped,
2548
+ time_class: T.untyped,
2497
2549
  _kwargs: T.untyped
2498
2550
  ).void
2499
2551
  end
2500
- def initialize(selector:, tasks:, timelines:, custom_fields:, **_kwargs); end
2552
+ def initialize(selector:, tasks:, timelines:, custom_fields:, time_class: Time, **_kwargs); end
2501
2553
 
2502
2554
  sig { returns(T.untyped) }
2503
2555
  attr_reader :tasks
@@ -2508,6 +2560,9 @@ module Checkoff
2508
2560
  sig { returns(T.untyped) }
2509
2561
  attr_reader :custom_fields
2510
2562
 
2563
+ sig { returns(T.untyped) }
2564
+ attr_reader :time_class
2565
+
2511
2566
  sig { returns(T.untyped) }
2512
2567
  attr_reader :selector
2513
2568
  end
@@ -2517,7 +2572,7 @@ end
2517
2572
  # typed: ignore
2518
2573
  # Command-line and gem client for Asana (unofficial)
2519
2574
  module Checkoff
2520
- VERSION = T.let('0.273.0', T.untyped)
2575
+ VERSION = T.let('0.275.0', T.untyped)
2521
2576
 
2522
2577
  # Move tasks from one place to another
2523
2578
  class MvSubcommand
@@ -2784,6 +2839,11 @@ module Checkoff
2784
2839
  # Provide ability for CLI to pull Asana items
2785
2840
  class CheckoffGLIApp
2786
2841
  extend GLI::App
2842
+
2843
+ class << self
2844
+ sig { returns(T.nilable(SubcommandFactory)) }
2845
+ attr_accessor :subcommand_factory
2846
+ end
2787
2847
  end
2788
2848
 
2789
2849
  # Work with tags in Asana
@@ -2805,16 +2865,19 @@ module Checkoff
2805
2865
  # _@param_ `projects`
2806
2866
  #
2807
2867
  # _@param_ `workspaces`
2868
+ #
2869
+ # _@param_ `asana_resources_collection_class`
2808
2870
  sig do
2809
2871
  params(
2810
2872
  config: T.any(Checkoff::Internal::EnvFallbackConfigLoader, T::Hash[T.untyped, T.untyped]),
2811
2873
  clients: Checkoff::Clients,
2812
2874
  client: Asana::Client,
2813
2875
  projects: Checkoff::Projects,
2814
- workspaces: Checkoff::Workspaces
2876
+ workspaces: Checkoff::Workspaces,
2877
+ asana_resources_collection_class: T.class_of(Asana::Resources::Collection)
2815
2878
  ).void
2816
2879
  end
2817
- def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana), clients: Checkoff::Clients.new(config:), client: clients.client, projects: Checkoff::Projects.new(config:, client:), workspaces: Checkoff::Workspaces.new(config:, client:)); end
2880
+ def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana), clients: Checkoff::Clients.new(config:), client: clients.client, projects: Checkoff::Projects.new(config:, client:), workspaces: Checkoff::Workspaces.new(config:, client:), asana_resources_collection_class: Asana::Resources::Collection); end
2818
2881
 
2819
2882
  # _@param_ `workspace_name`
2820
2883
  #
@@ -4374,8 +4437,11 @@ module Checkoff
4374
4437
  sig { params(response: Asana::HttpClient::Response).returns([T::Hash[T.untyped, T.untyped], T::Hash[T.untyped, T.untyped]]) }
4375
4438
  def parse(response); end
4376
4439
 
4377
- sig { void }
4378
- def self.run; end
4440
+ # _@param_ `tasks_class`
4441
+ #
4442
+ # _@param_ `attachments_class`
4443
+ sig { params(tasks_class: T.class_of(Checkoff::Tasks), attachments_class: T.class_of(Checkoff::Attachments)).void }
4444
+ def self.run(tasks_class: Checkoff::Tasks, attachments_class: Checkoff::Attachments); end
4379
4445
 
4380
4446
  sig { returns(::Logger) }
4381
4447
  def logger; end
@@ -4688,19 +4754,22 @@ module Checkoff
4688
4754
  # _@param_ `timelines`
4689
4755
  #
4690
4756
  # _@param_ `custom_fields`
4757
+ #
4758
+ # _@param_ `time_class`
4691
4759
  sig do
4692
4760
  params(
4693
4761
  config: T.any(T::Hash[T.untyped, T.untyped], Checkoff::Internal::EnvFallbackConfigLoader),
4694
4762
  client: Asana::Client,
4695
4763
  tasks: Checkoff::Tasks,
4696
4764
  timelines: Checkoff::Timelines,
4697
- custom_fields: Checkoff::CustomFields
4765
+ custom_fields: Checkoff::CustomFields,
4766
+ time_class: T.class_of(Time)
4698
4767
  ).void
4699
4768
  end
4700
4769
  def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana), client: Checkoff::Clients.new(config:).client, tasks: Checkoff::Tasks.new(config:,
4701
4770
  client:), timelines: Checkoff::Timelines.new(config:,
4702
4771
  client:), custom_fields: Checkoff::CustomFields.new(config:,
4703
- client:)); end
4772
+ client:), time_class: Time); end
4704
4773
 
4705
4774
  # _@param_ `task`
4706
4775
  #
@@ -4983,8 +5052,17 @@ module Checkoff
4983
5052
  # _@param_ `sym`
4984
5053
  #
4985
5054
  # _@param_ `yaml_filename`
4986
- sig { params(config: T::Hash[Symbol, T.untyped], sym: Symbol, yaml_filename: String).void }
4987
- def initialize(config, sym, yaml_filename); end
5055
+ #
5056
+ # _@param_ `env`
5057
+ sig do
5058
+ params(
5059
+ config: T::Hash[Symbol, T.untyped],
5060
+ sym: Symbol,
5061
+ yaml_filename: String,
5062
+ env: T.any(RBS::Unnamed::ENVClass, T::Hash[String, String])
5063
+ ).void
5064
+ end
5065
+ def initialize(config, sym, yaml_filename, env: ENV); end
4988
5066
 
4989
5067
  # _@param_ `key`
4990
5068
  sig { params(key: Symbol).returns(T.nilable(Object)) }
@@ -5002,12 +5080,16 @@ module Checkoff
5002
5080
  # Load configuration file
5003
5081
  class ConfigLoader
5004
5082
  # _@param_ `sym`
5005
- sig { params(sym: Symbol).returns(EnvFallbackConfigLoader) }
5006
- def self.load(sym); end
5083
+ #
5084
+ # _@param_ `filename`
5085
+ #
5086
+ # _@param_ `env`
5087
+ sig { params(sym: Symbol, filename: String, env: T.any(RBS::Unnamed::ENVClass, T::Hash[String, String])).returns(EnvFallbackConfigLoader) }
5088
+ def self.load(sym, filename: yaml_filename(sym), env: ENV); end
5007
5089
 
5008
- # _@param_ `sym`
5009
- sig { params(sym: Symbol).returns(T::Hash[Symbol, T.untyped]) }
5010
- def self.load_yaml_file(sym); end
5090
+ # _@param_ `filename`
5091
+ sig { params(filename: String).returns(T::Hash[Symbol, T.untyped]) }
5092
+ def self.load_yaml_file(filename); end
5011
5093
 
5012
5094
  # _@param_ `sym`
5013
5095
  sig { params(sym: Symbol).returns(String) }
@@ -6008,6 +6090,8 @@ module Checkoff
6008
6090
  #
6009
6091
  # _@param_ `custom_fields`
6010
6092
  #
6093
+ # _@param_ `time_class`
6094
+ #
6011
6095
  # _@param_ `_kwargs`
6012
6096
  sig do
6013
6097
  params(
@@ -6015,10 +6099,11 @@ module Checkoff
6015
6099
  tasks: Checkoff::Tasks,
6016
6100
  timelines: Checkoff::Timelines,
6017
6101
  custom_fields: Checkoff::CustomFields,
6102
+ time_class: T.class_of(Time),
6018
6103
  _kwargs: T.untyped
6019
6104
  ).void
6020
6105
  end
6021
- def initialize(selector:, tasks:, timelines:, custom_fields:, **_kwargs); end
6106
+ def initialize(selector:, tasks:, timelines:, custom_fields:, time_class: Time, **_kwargs); end
6022
6107
 
6023
6108
  sig { returns(Checkoff::Tasks) }
6024
6109
  attr_reader :tasks
@@ -6031,6 +6116,9 @@ module Checkoff
6031
6116
 
6032
6117
  sig { returns(T.any(T::Array[T.any(Symbol, T::Array[T.untyped])], Symbol, String)) }
6033
6118
  attr_reader :selector
6119
+
6120
+ sig { returns(T.class_of(Time)) }
6121
+ attr_reader :time_class
6034
6122
  end
6035
6123
  end
6036
6124
 
@@ -6472,15 +6560,18 @@ end - [Checkoff::SelectorClasses::Task::FunctionEvaluator]).freeze, T.untyped)
6472
6560
  # _@param_ `timelines`
6473
6561
  #
6474
6562
  # _@param_ `custom_fields`
6563
+ #
6564
+ # _@param_ `time_class`
6475
6565
  sig do
6476
6566
  params(
6477
6567
  task: Asana::Resources::Task,
6478
6568
  tasks: Checkoff::Tasks,
6479
6569
  timelines: Checkoff::Timelines,
6480
- custom_fields: Checkoff::CustomFields
6570
+ custom_fields: Checkoff::CustomFields,
6571
+ time_class: T.class_of(Time)
6481
6572
  ).void
6482
6573
  end
6483
- def initialize(task:, tasks: Checkoff::Tasks.new, timelines: Checkoff::Timelines.new, custom_fields: Checkoff::CustomFields.new); end
6574
+ def initialize(task:, tasks: Checkoff::Tasks.new, timelines: Checkoff::Timelines.new, custom_fields: Checkoff::CustomFields.new, time_class: Time); end
6484
6575
 
6485
6576
  sig { returns(T::Array[T.class_of(Checkoff::SelectorClasses::Task::FunctionEvaluator)]) }
6486
6577
  def function_evaluators; end
@@ -6499,6 +6590,9 @@ end - [Checkoff::SelectorClasses::Task::FunctionEvaluator]).freeze, T.untyped)
6499
6590
 
6500
6591
  sig { returns(Checkoff::CustomFields) }
6501
6592
  attr_reader :custom_fields
6593
+
6594
+ sig { returns(T.class_of(Time)) }
6595
+ attr_reader :time_class
6502
6596
  end
6503
6597
 
6504
6598
  # Evaluates project selectors against a project
@@ -6607,6 +6701,63 @@ end - [Checkoff::SelectorClasses::Section::FunctionEvaluator]).freeze, T.untyped
6607
6701
  sig { returns(Asana::Client) }
6608
6702
  attr_reader :client
6609
6703
  end
6704
+
6705
+ # Builds the subcommands CheckoffGLIApp runs, giving the quickadd and
6706
+ # view subcommands the collaborators they accept out of those passed
6707
+ # here; the rest fall back to the subcommand's own defaults.
6708
+ class SubcommandFactory
6709
+ # _@param_ `mv_subcommand_class`
6710
+ #
6711
+ # _@param_ `collaborators`
6712
+ sig { params(mv_subcommand_class: T.class_of(MvSubcommand), collaborators: Object).void }
6713
+ def initialize(mv_subcommand_class: MvSubcommand, **collaborators); end
6714
+
6715
+ # _@param_ `workspace_name`
6716
+ #
6717
+ # _@param_ `task_name`
6718
+ sig { params(workspace_name: String, task_name: String).returns(QuickaddSubcommand) }
6719
+ def quickadd(workspace_name, task_name); end
6720
+
6721
+ # _@param_ `workspace_name`
6722
+ #
6723
+ # _@param_ `project_name`
6724
+ #
6725
+ # _@param_ `section_name`
6726
+ #
6727
+ # _@param_ `task_name`
6728
+ sig do
6729
+ params(
6730
+ workspace_name: String,
6731
+ project_name: String,
6732
+ section_name: T.nilable(String),
6733
+ task_name: T.nilable(String)
6734
+ ).returns(ViewSubcommand)
6735
+ end
6736
+ def view(workspace_name, project_name, section_name, task_name); end
6737
+
6738
+ # _@param_ `from_workspace_arg`
6739
+ #
6740
+ # _@param_ `from_project_arg`
6741
+ #
6742
+ # _@param_ `from_section_arg`
6743
+ #
6744
+ # _@param_ `to_workspace_arg`
6745
+ #
6746
+ # _@param_ `to_project_arg`
6747
+ #
6748
+ # _@param_ `to_section_arg`
6749
+ sig do
6750
+ params(
6751
+ from_workspace_arg: T.any(Symbol, String),
6752
+ from_project_arg: T.any(Symbol, String),
6753
+ from_section_arg: T.nilable(String),
6754
+ to_workspace_arg: T.any(Symbol, String),
6755
+ to_project_arg: T.any(Symbol, String),
6756
+ to_section_arg: T.nilable(T.any(Symbol, String))
6757
+ ).returns(MvSubcommand)
6758
+ end
6759
+ def mv(from_workspace_arg:, from_project_arg:, from_section_arg:, to_workspace_arg:, to_project_arg:, to_section_arg:); end
6760
+ end
6610
6761
  end
6611
6762
 
6612
6763
  # include this to add ability to log at different levels
data/sig/checkoff.rbs CHANGED
@@ -221,6 +221,11 @@ module Checkoff
221
221
  # Provide ability for CLI to pull Asana items
222
222
  class CheckoffGLIApp
223
223
  extend GLI::App
224
+
225
+ def self.subcommand_factory: () -> SubcommandFactory?
226
+
227
+ # _@return_ — nil restores the default
228
+ def self.subcommand_factory=: (SubcommandFactory? value) -> SubcommandFactory?
224
229
  end
225
230
 
226
231
  # Work with tags in Asana
@@ -242,12 +247,15 @@ module Checkoff
242
247
  # _@param_ `projects`
243
248
  #
244
249
  # _@param_ `workspaces`
250
+ #
251
+ # _@param_ `asana_resources_collection_class`
245
252
  def initialize: (
246
253
  ?config: (Checkoff::Internal::EnvFallbackConfigLoader | ::Hash[untyped, untyped]),
247
254
  ?clients: Checkoff::Clients,
248
255
  ?client: Asana::Client,
249
256
  ?projects: Checkoff::Projects,
250
- ?workspaces: Checkoff::Workspaces
257
+ ?workspaces: Checkoff::Workspaces,
258
+ ?asana_resources_collection_class: singleton(Asana::Resources::Collection)
251
259
  ) -> void
252
260
 
253
261
  # _@param_ `workspace_name`
@@ -1223,7 +1231,7 @@ module Checkoff
1223
1231
  # _@param_ `by_section`
1224
1232
  #
1225
1233
  # _@param_ `task`
1226
- def file_task_by_section: (String? current_section, ::Hash[untyped, untyped] by_section, Asana::Resources::Task task) -> ([String, ::Hash[untyped, untyped]] | [NilClass, ::Hash[untyped, untyped]])
1234
+ def file_task_by_section: (String? current_section, ::Hash[untyped, untyped] by_section, Asana::Resources::Task task) -> ([String, ::Hash[untyped, untyped]] | [nil, ::Hash[untyped, untyped]])
1227
1235
 
1228
1236
  attr_reader projects: Checkoff::Projects
1229
1237
 
@@ -1269,7 +1277,7 @@ module Checkoff
1269
1277
  # _@param_ `gid`
1270
1278
  #
1271
1279
  # _@param_ `resource_type`
1272
- def resource_by_gid: (String gid, ?resource_type: String?) -> ([Asana::Resources::Task, String] | [Asana::Resources::Section, String] | [Asana::Resources::Project, String] | [NilClass, NilClass])
1280
+ def resource_by_gid: (String gid, ?resource_type: String?) -> ([Asana::Resources::Task, String] | [Asana::Resources::Section, String] | [Asana::Resources::Project, String] | [nil, nil])
1273
1281
 
1274
1282
  # _@param_ `resource_type`
1275
1283
  #
@@ -1544,7 +1552,10 @@ module Checkoff
1544
1552
  # _@param_ `response`
1545
1553
  def parse: (Asana::HttpClient::Response response) -> [::Hash[untyped, untyped], ::Hash[untyped, untyped]]
1546
1554
 
1547
- def self.run: () -> void
1555
+ # _@param_ `tasks_class`
1556
+ #
1557
+ # _@param_ `attachments_class`
1558
+ def self.run: (?tasks_class: singleton(Checkoff::Tasks), ?attachments_class: singleton(Checkoff::Attachments)) -> void
1548
1559
 
1549
1560
  def logger: () -> ::Logger
1550
1561
 
@@ -1809,12 +1820,15 @@ module Checkoff
1809
1820
  # _@param_ `timelines`
1810
1821
  #
1811
1822
  # _@param_ `custom_fields`
1823
+ #
1824
+ # _@param_ `time_class`
1812
1825
  def initialize: (
1813
1826
  ?config: (::Hash[untyped, untyped] | Checkoff::Internal::EnvFallbackConfigLoader),
1814
1827
  ?client: Asana::Client,
1815
1828
  ?tasks: Checkoff::Tasks,
1816
1829
  ?timelines: Checkoff::Timelines,
1817
- ?custom_fields: Checkoff::CustomFields
1830
+ ?custom_fields: Checkoff::CustomFields,
1831
+ ?time_class: singleton(Time)
1818
1832
  ) -> void
1819
1833
 
1820
1834
  # _@param_ `task`
@@ -2048,7 +2062,14 @@ module Checkoff
2048
2062
  # _@param_ `sym`
2049
2063
  #
2050
2064
  # _@param_ `yaml_filename`
2051
- def initialize: (::Hash[Symbol, untyped] config, Symbol sym, String yaml_filename) -> void
2065
+ #
2066
+ # _@param_ `env`
2067
+ def initialize: (
2068
+ ::Hash[Symbol, untyped] config,
2069
+ Symbol sym,
2070
+ String yaml_filename,
2071
+ ?env: (RBS::Unnamed::ENVClass | ::Hash[String, String])
2072
+ ) -> void
2052
2073
 
2053
2074
  # _@param_ `key`
2054
2075
  def []: (Symbol key) -> Object?
@@ -2063,10 +2084,14 @@ module Checkoff
2063
2084
  # Load configuration file
2064
2085
  class ConfigLoader
2065
2086
  # _@param_ `sym`
2066
- def self.load: (Symbol sym) -> EnvFallbackConfigLoader
2087
+ #
2088
+ # _@param_ `filename`
2089
+ #
2090
+ # _@param_ `env`
2091
+ def self.load: (Symbol sym, ?filename: String, ?env: (RBS::Unnamed::ENVClass | ::Hash[String, String])) -> EnvFallbackConfigLoader
2067
2092
 
2068
- # _@param_ `sym`
2069
- def self.load_yaml_file: (Symbol sym) -> ::Hash[Symbol, untyped]
2093
+ # _@param_ `filename`
2094
+ def self.load_yaml_file: (String filename) -> ::Hash[Symbol, untyped]
2070
2095
 
2071
2096
  # _@param_ `sym`
2072
2097
  def self.yaml_filename: (Symbol sym) -> String
@@ -2559,7 +2584,7 @@ module Checkoff
2559
2584
  # _@param_ `gid`
2560
2585
  #
2561
2586
  # _@param_ `resource_type`
2562
- def enrich_gid: (String gid, ?resource_type: String?) -> ([String, String] | [NilClass, String] | [NilClass, NilClass])
2587
+ def enrich_gid: (String gid, ?resource_type: String?) -> ([String, String] | [nil, String] | [nil, nil])
2563
2588
 
2564
2589
  # _@param_ `filter`
2565
2590
  def enrich_filter_parent_gid!: (::Hash[String, (String | ::Array[String])] filter) -> void
@@ -2867,12 +2892,15 @@ module Checkoff
2867
2892
  #
2868
2893
  # _@param_ `custom_fields`
2869
2894
  #
2895
+ # _@param_ `time_class`
2896
+ #
2870
2897
  # _@param_ `_kwargs`
2871
2898
  def initialize: (
2872
2899
  selector: (::Array[(Symbol | ::Array[untyped])] | Symbol | String),
2873
2900
  tasks: Checkoff::Tasks,
2874
2901
  timelines: Checkoff::Timelines,
2875
2902
  custom_fields: Checkoff::CustomFields,
2903
+ ?time_class: singleton(Time),
2876
2904
  **untyped _kwargs
2877
2905
  ) -> void
2878
2906
 
@@ -2883,6 +2911,8 @@ module Checkoff
2883
2911
  attr_reader custom_fields: Checkoff::CustomFields
2884
2912
 
2885
2913
  attr_reader selector: (::Array[(Symbol | ::Array[untyped])] | Symbol | String)
2914
+
2915
+ attr_reader time_class: singleton(Time)
2886
2916
  end
2887
2917
  end
2888
2918
 
@@ -3250,11 +3280,14 @@ module Checkoff
3250
3280
  # _@param_ `timelines`
3251
3281
  #
3252
3282
  # _@param_ `custom_fields`
3283
+ #
3284
+ # _@param_ `time_class`
3253
3285
  def initialize: (
3254
3286
  task: Asana::Resources::Task,
3255
3287
  ?tasks: Checkoff::Tasks,
3256
3288
  ?timelines: Checkoff::Timelines,
3257
- ?custom_fields: Checkoff::CustomFields
3289
+ ?custom_fields: Checkoff::CustomFields,
3290
+ ?time_class: singleton(Time)
3258
3291
  ) -> void
3259
3292
 
3260
3293
  def function_evaluators: () -> ::Array[singleton(Checkoff::SelectorClasses::Task::FunctionEvaluator)]
@@ -3268,6 +3301,8 @@ module Checkoff
3268
3301
  attr_reader timelines: Checkoff::Timelines
3269
3302
 
3270
3303
  attr_reader custom_fields: Checkoff::CustomFields
3304
+
3305
+ attr_reader time_class: singleton(Time)
3271
3306
  end
3272
3307
 
3273
3308
  # Evaluates project selectors against a project
@@ -3348,6 +3383,55 @@ module Checkoff
3348
3383
 
3349
3384
  attr_reader client: Asana::Client
3350
3385
  end
3386
+
3387
+ # Builds the subcommands CheckoffGLIApp runs, giving the quickadd and
3388
+ # view subcommands the collaborators they accept out of those passed
3389
+ # here; the rest fall back to the subcommand's own defaults.
3390
+ class SubcommandFactory
3391
+ # _@param_ `mv_subcommand_class`
3392
+ #
3393
+ # _@param_ `collaborators`
3394
+ def initialize: (?mv_subcommand_class: singleton(MvSubcommand), **Object collaborators) -> void
3395
+
3396
+ # _@param_ `workspace_name`
3397
+ #
3398
+ # _@param_ `task_name`
3399
+ def quickadd: (String workspace_name, String task_name) -> QuickaddSubcommand
3400
+
3401
+ # _@param_ `workspace_name`
3402
+ #
3403
+ # _@param_ `project_name`
3404
+ #
3405
+ # _@param_ `section_name`
3406
+ #
3407
+ # _@param_ `task_name`
3408
+ def view: (
3409
+ String workspace_name,
3410
+ String project_name,
3411
+ String? section_name,
3412
+ String? task_name
3413
+ ) -> ViewSubcommand
3414
+
3415
+ # _@param_ `from_workspace_arg`
3416
+ #
3417
+ # _@param_ `from_project_arg`
3418
+ #
3419
+ # _@param_ `from_section_arg`
3420
+ #
3421
+ # _@param_ `to_workspace_arg`
3422
+ #
3423
+ # _@param_ `to_project_arg`
3424
+ #
3425
+ # _@param_ `to_section_arg`
3426
+ def mv: (
3427
+ from_workspace_arg: (Symbol | String),
3428
+ from_project_arg: (Symbol | String),
3429
+ from_section_arg: String?,
3430
+ to_workspace_arg: (Symbol | String),
3431
+ to_project_arg: (Symbol | String),
3432
+ to_section_arg: (Symbol | String)?
3433
+ ) -> MvSubcommand
3434
+ end
3351
3435
  end
3352
3436
 
3353
3437
  # include this to add ability to log at different levels
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: checkoff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.273.0
4
+ version: 0.275.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vince Broz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-11-04 00:00:00.000000000 Z
11
+ date: 2026-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport