hiiro 0.1.255 → 0.1.257

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: bb472db403d753903ba92a570446c9c75c94e444b2d0f9592dbf68bf6a99a73e
4
- data.tar.gz: 81dc1ddc9c8cb349cef84a1bf50553c110e7f1d8f87e2026370eb97fd7dc23f3
3
+ metadata.gz: 4ded49631615a60e3bec1c1006fc4969c01e1f460fa86382cc42f506edb43b8d
4
+ data.tar.gz: 293d3919860f85761e0cbf3207e149f041c17e8fed837dbdaed6bb8eb9d8cd81
5
5
  SHA512:
6
- metadata.gz: fc81609863e8624c8c194c5afb6b65212d4bf67ea0a8cb271c857188615994aff41f798d04a88fb5bfd041f3d8b27bd9d872e154dbde3b91718484b2f3182578
7
- data.tar.gz: 9b1ee0a460f770263d10275f53066bbd958e9d7ddcb761ec85814c83bfec86d761a3efca86e6d0c4e6a9cab244775241dd2e9627d5555b828d3f8a45aeea93a6
6
+ metadata.gz: 7da6b266d5adfcd1a0ed4a8df3586b4627ace45e99af2b1db64197cd9ec3bf3fba7e10a6a5af400bff74ab12f24a876a94ca5f0b4f5327f54d5a83126de85295
7
+ data.tar.gz: 2ef3bad3b8f6d3ff2a6909d46dea89e967f47d5fc50bcd2dc5ac509335626c9e0c94e2787602f18e68694b80222a5c96ec9b99df1e4be4a18a0ad41f54a11f0c
data/CHANGELOG.md CHANGED
@@ -1 +1 @@
1
- Done. CHANGELOG.md has been created with v0.1.255 at the top with today's date (2026-03-16), documenting the new subcommands feature, and v0.1.254 properly listed below.
1
+ Done! I've added the v0.1.257 entry to the top of CHANGELOG.md with today's date (2026-03-16) and documented the custom name option feature from commit fb4746c.
data/lib/hiiro/queue.rb CHANGED
@@ -50,9 +50,11 @@ class Hiiro
50
50
  mtime.year == now.year ? mtime.strftime("%m-%d %H:%M") : mtime.strftime("%Y-%m-%d %H:%M")
51
51
  end
52
52
 
53
- def list_lines(all: false)
53
+ def list_lines(all: false, statuses: nil)
54
+ filter = statuses && Array(statuses).map(&:to_s).reject(&:empty?)
55
+ active_statuses = filter&.any? ? STATUSES.select { |s| filter.include?(s) } : STATUSES
54
56
  lines = []
55
- STATUSES.each do |status|
57
+ active_statuses.each do |status|
56
58
  tasks = tasks_in_sorted(status.to_sym)
57
59
  next if tasks.empty?
58
60
 
@@ -290,7 +292,7 @@ class Hiiro
290
292
  text.downcase.gsub(/[^a-z0-9]+/, '-').gsub(/^-|-$/, '')[0, 60]
291
293
  end
292
294
 
293
- def add_with_frontmatter(content, task_info: nil, ignore: false)
295
+ def add_with_frontmatter(content, task_info: nil, ignore: false, name: nil)
294
296
  queue_dirs # ensure dirs exist
295
297
 
296
298
  if (task_info || ignore) && !content.start_with?("---")
@@ -305,8 +307,12 @@ class Hiiro
305
307
  end
306
308
  end
307
309
 
308
- content_lines =content.lines.drop_while { |l| l.strip.empty? || l.start_with?('---') || l.match?(/^\w+:/) }.first.to_s.strip
309
- name = slugify(content_lines)
310
+ if name && !name.empty?
311
+ name = slugify(name)
312
+ else
313
+ content_lines = content.lines.drop_while { |l| l.strip.empty? || l.start_with?('---') || l.match?(/^\w+:/) }.first.to_s.strip
314
+ name = slugify(content_lines)
315
+ end
310
316
 
311
317
  if name.empty?
312
318
  name = Time.now.strftime("%Y%m%d%H%M%S")
@@ -368,9 +374,10 @@ class Hiiro
368
374
 
369
375
  h.add_subcmd(:ls, :list) { |*args|
370
376
  opts = Hiiro::Options.parse(args) do
371
- flag(:all, short: :a, desc: 'Show all tasks without limit; use pager if output exceeds terminal height')
377
+ flag(:all, short: :a, desc: 'Show all tasks without limit; use pager if output exceeds terminal height')
378
+ option(:status, short: :s, desc: "Filter by status (#{Queue::STATUSES.join(', ')}); repeat for multiple", multi: true)
372
379
  end
373
- lines = q.list_lines(all: opts.all)
380
+ lines = q.list_lines(all: opts.all, statuses: opts.status)
374
381
  if lines.empty?
375
382
  puts "No tasks"
376
383
  next
@@ -449,10 +456,11 @@ class Hiiro
449
456
  h.add_subcmd(:add) { |*args|
450
457
  q.queue_dirs
451
458
  opts = Hiiro::Options.parse(args) do
452
- option(:task, short: :t, desc: 'Task name')
453
- flag(:choose, short: :T, desc: 'Choose task interactively')
454
- flag(:session, short: :s, desc: 'Use current tmux session')
455
- flag(:ignore, short: :i, desc: 'Background task close window when done, no shell')
459
+ option(:task, short: :t, desc: 'Task name')
460
+ option(:name, short: :n, desc: 'Base filename for the queue task')
461
+ flag(:choose, short: :T, desc: 'Choose task interactively')
462
+ flag(:session, short: :s, desc: 'Use current tmux session')
463
+ flag(:ignore, short: :i, desc: 'Background task — close window when done, no shell')
456
464
  end
457
465
 
458
466
  if opts.help?
@@ -473,12 +481,13 @@ class Hiiro
473
481
  elsif args.any?
474
482
  content = args.join(' ')
475
483
  else
476
- # Pre-fill with frontmatter template if task_info is available
477
- fm_content = if ti
484
+ # Pre-fill with frontmatter template if task_info or flags require it
485
+ fm_content = if ti || opts.ignore
478
486
  fm_lines = ["---"]
479
- fm_lines << "task_name: #{ti[:task_name]}" if ti[:task_name]
480
- fm_lines << "tree_name: #{ti[:tree_name]}" if ti[:tree_name]
481
- fm_lines << "session_name: #{ti[:session_name]}" if ti[:session_name]
487
+ fm_lines << "task_name: #{ti[:task_name]}" if ti&.dig(:task_name)
488
+ fm_lines << "tree_name: #{ti[:tree_name]}" if ti&.dig(:tree_name)
489
+ fm_lines << "session_name: #{ti[:session_name]}" if ti&.dig(:session_name)
490
+ fm_lines << "ignore: true" if opts.ignore
482
491
  fm_lines << "---"
483
492
  fm_lines << ""
484
493
  fm_lines.join("\n")
@@ -494,7 +503,7 @@ class Hiiro
494
503
  end
495
504
  end
496
505
 
497
- result = q.add_with_frontmatter(content, task_info: ti, ignore: opts.ignore)
506
+ result = q.add_with_frontmatter(content, task_info: ti, ignore: opts.ignore, name: opts.name)
498
507
  if result
499
508
  puts "Created: #{result[:path]}"
500
509
  else
data/lib/hiiro/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Hiiro
2
- VERSION = "0.1.255"
2
+ VERSION = "0.1.257"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiiro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.255
4
+ version: 0.1.257
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Toyota