hiiro 0.1.369 → 0.1.370
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/docs/t.md +1 -1
- data/lib/hiiro/task_cli.rb +22 -4
- data/lib/hiiro/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 032503df05064bda5cc037dd3cd37eccea64c836264d08f40f9a23455d08f8a6
|
|
4
|
+
data.tar.gz: e9b478550d879b3b205e0ca9f04d442782a94c777116eb06901e726c21e785c7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 31f274880fc13eb3448a7970030c78e5d86a1807aff1bdd0ad66f2ffa9c87076f59c174f9d9ac74400a1fc773ad866a5e798f4d3f19e2d977c949ec59ba3514e
|
|
7
|
+
data.tar.gz: 931992993a1505231ae81781a3d8707c40d94c762c3902484c1a1357a5fe02240c616374d64e51622db5be11bae0abd7fc40114f0c994ebd4b4cf18669dd304b
|
data/CHANGELOG.md
CHANGED
data/docs/t.md
CHANGED
|
@@ -29,7 +29,7 @@ Task names may be `parent/child` for subtasks. `t new NAME` creates exactly `NAM
|
|
|
29
29
|
|
|
30
30
|
| Command | Behavior |
|
|
31
31
|
|---|---|
|
|
32
|
-
| `t`, `t ls`, `t list` | Lists all tasks alphabetically with open todo counts, e.g. `prez (3)`, plus `next:` and `waiting:` text |
|
|
32
|
+
| `t`, `t ls`, `t list` | Lists all tasks alphabetically with open todo counts, e.g. `prez (3)`, plus `next:` and `waiting:` text. When Herdr is running, tasks whose workspace is open get an `@` marker, and live workspaces that belong to no task are listed afterwards with their IDs |
|
|
33
33
|
| `t show [TASK]` | Status, home, next action, waiting text, code directory, workspace label, resources, documents, and todos |
|
|
34
34
|
| `t current [TASK]` | Prints the resolved task name; never saves |
|
|
35
35
|
| `t use TASK` (alias `pin`) | Saves TASK as the fallback for when no workspace or directory identifies a task |
|
data/lib/hiiro/task_cli.rb
CHANGED
|
@@ -40,7 +40,6 @@ class Hiiro
|
|
|
40
40
|
add_flag :find, short: :f, desc: 'Choose the task with a fuzzy finder'
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
-
# Exact name, else unique prefix; ambiguous prefixes fail; nil when nothing matches.
|
|
44
43
|
# Exact name, else unique prefix. An ambiguous prefix opens the fuzzy finder
|
|
45
44
|
# over the candidates on a TTY and fails otherwise. nil when nothing matches.
|
|
46
45
|
def lookup_task(reference)
|
|
@@ -180,24 +179,43 @@ class Hiiro
|
|
|
180
179
|
end
|
|
181
180
|
end
|
|
182
181
|
|
|
182
|
+
# Live Herdr workspaces, or [] when Herdr is not running.
|
|
183
|
+
def live_workspaces
|
|
184
|
+
herdr_client.server_running? ? client.workspaces.to_a : []
|
|
185
|
+
rescue Hiiro::Error
|
|
186
|
+
[]
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Tasks with open todo counts, an @ marker when the task workspace is open,
|
|
190
|
+
# then any live Herdr workspaces that belong to no task.
|
|
183
191
|
def list_tasks
|
|
184
192
|
tasks = Hiiro::TaskRecord.all_as_list
|
|
185
|
-
|
|
193
|
+
workspaces = live_workspaces
|
|
194
|
+
labels = tasks.map { |task| workspace_label(task) }
|
|
195
|
+
open_labels = workspaces.map(&:name)
|
|
196
|
+
loose = workspaces.reject { |workspace| labels.include?(workspace.name) }
|
|
197
|
+
if tasks.empty? && loose.empty?
|
|
186
198
|
puts 'No tasks. Create one with t new NAME.'
|
|
187
199
|
return
|
|
188
200
|
end
|
|
189
201
|
counts = open_todo_counts
|
|
202
|
+
attached = tasks.any? { |task| open_labels.include?(workspace_label(task)) }
|
|
190
203
|
rows = tasks.map do |task|
|
|
191
204
|
count = counts[task.name]
|
|
192
205
|
label = count.zero? ? task.name : "#{task.name} (#{count})"
|
|
206
|
+
label = "#{open_labels.include?(workspace_label(task)) ? '@' : ' '} #{label}" if attached
|
|
193
207
|
detail = []
|
|
194
208
|
detail << "next: #{task.next_action}" if task.next_action
|
|
195
209
|
detail << "waiting: #{task.waiting_on}" if task.waiting_on
|
|
196
210
|
[label, task.task_status, detail.join(' ')]
|
|
197
211
|
end
|
|
198
|
-
name_col = rows.map { |row| row[0].length }.max
|
|
199
|
-
status_col = rows.map { |row| row[1].length }.max
|
|
212
|
+
name_col = rows.map { |row| row[0].length }.max || 0
|
|
213
|
+
status_col = rows.map { |row| row[1].length }.max || 0
|
|
200
214
|
rows.each { |label, status, detail| puts format("%-#{name_col}s %-#{status_col}s %s", label, status, detail).rstrip }
|
|
215
|
+
return if loose.empty?
|
|
216
|
+
puts unless rows.empty?
|
|
217
|
+
puts 'Workspaces without a task:'
|
|
218
|
+
loose.each { |workspace| puts " #{workspace.name} #{workspace.id}" }
|
|
201
219
|
end
|
|
202
220
|
|
|
203
221
|
|
data/lib/hiiro/version.rb
CHANGED