hiiro 0.1.350 → 0.1.351
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 +6 -0
- data/bin/h-capture +34 -9
- 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: '0586a9cc0e070785c9a0ef12282146ed71172875e706480d3dca6d663f5a46e8'
|
|
4
|
+
data.tar.gz: ffec55f5b2ce8882cb06189dedf5e29ccb75a3b8214a76fc72e7dc460851f2cd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e40c167924bce7ac225b17e0fd7c82855c0d6034e66814c4b3e4897ee00dc80b9214b52dafe4d3a98c7916b0194c0a7d4b234e9f55a5a51fd0d73329315132ee
|
|
7
|
+
data.tar.gz: 994e44431c7a4dc5a15a2eaaa0ffa6c9b0382229b5d84dac1521c56129b599c08316e124511e6f5cf830e7189ab326672e599c228c11b7ddb7776be42c86bfdc
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- `h capture path <num>` now prints the path of the Nth most recent capture (was always printing the captures dir regardless of args)
|
|
7
|
+
- `h capture new` / `h capture file` now record to the DB even when interrupted (Ctrl-C, exception) so partial captures show up in `h capture ls`. Interrupted captures display with the existing `?` glyph and `(exit interrupted)` message.
|
|
8
|
+
|
|
3
9
|
## [0.1.350] - 2026-04-18
|
|
4
10
|
|
|
5
11
|
### Added
|
data/bin/h-capture
CHANGED
|
@@ -26,7 +26,13 @@ CAPTURES_DIR = File.expand_path('~/.local/share/hiiro/captures')
|
|
|
26
26
|
# Whichever rules you pick, this 5–8 line method is the contract for where
|
|
27
27
|
# `h capture file` writes — so it's worth getting right for your workflow.
|
|
28
28
|
def resolve_path(name_or_path)
|
|
29
|
-
|
|
29
|
+
if File.dirname(name_or_path) != ?.
|
|
30
|
+
FileUtils.mkdir_p(File.dirname(name_or_path))
|
|
31
|
+
return name_or_path
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
FileUtils.mkdir_p(CAPTURES_DIR)
|
|
35
|
+
File.join(CAPTURES_DIR, name_or_path)
|
|
30
36
|
end
|
|
31
37
|
|
|
32
38
|
def ensure_dir(path)
|
|
@@ -84,6 +90,19 @@ def record_capture(name:, path:, command:, exit_status:)
|
|
|
84
90
|
)
|
|
85
91
|
end
|
|
86
92
|
|
|
93
|
+
# Run the command and record the capture even if interrupted (Ctrl-C, error).
|
|
94
|
+
# `exit_status` is nil when the process didn't reach a clean exit — the `?`
|
|
95
|
+
# glyph in Hiiro::Capture#status_glyph already handles that case.
|
|
96
|
+
def capture_and_record(args, path:, name:)
|
|
97
|
+
code = nil
|
|
98
|
+
begin
|
|
99
|
+
code = run_and_capture(args, path)
|
|
100
|
+
ensure
|
|
101
|
+
record_capture(name: name, path: path, command: args.join(' '), exit_status: code)
|
|
102
|
+
warn "\n[capture saved: #{path} (exit #{code || 'interrupted'})]"
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
87
106
|
Hiiro.run(*ARGV) do
|
|
88
107
|
add_subcmd(:new) do |*args|
|
|
89
108
|
if args.empty?
|
|
@@ -95,9 +114,7 @@ Hiiro.run(*ARGV) do
|
|
|
95
114
|
path = File.join(CAPTURES_DIR, name)
|
|
96
115
|
ensure_dir(path)
|
|
97
116
|
|
|
98
|
-
|
|
99
|
-
record_capture(name: name, path: path, command: args.join(' '), exit_status: code)
|
|
100
|
-
warn "\n[capture saved: #{path} (exit #{code})]"
|
|
117
|
+
capture_and_record(args, path: path, name: name)
|
|
101
118
|
end
|
|
102
119
|
|
|
103
120
|
add_subcmd(:file) do |fpath = nil, *args|
|
|
@@ -109,9 +126,7 @@ Hiiro.run(*ARGV) do
|
|
|
109
126
|
path = resolve_path(fpath)
|
|
110
127
|
name = File.basename(fpath)
|
|
111
128
|
|
|
112
|
-
|
|
113
|
-
record_capture(name: name, path: path, command: args.join(' '), exit_status: code)
|
|
114
|
-
warn "\n[capture saved: #{path} (exit #{code})]"
|
|
129
|
+
capture_and_record(args, path: path, name: name)
|
|
115
130
|
end
|
|
116
131
|
|
|
117
132
|
add_subcmd(:ls) do |num = nil|
|
|
@@ -169,7 +184,17 @@ Hiiro.run(*ARGV) do
|
|
|
169
184
|
puts "Copied contents of: #{cap.path}"
|
|
170
185
|
end
|
|
171
186
|
|
|
172
|
-
add_subcmd(:path) do
|
|
173
|
-
|
|
187
|
+
add_subcmd(:path) do |num = nil|
|
|
188
|
+
if num.nil?
|
|
189
|
+
print CAPTURES_DIR
|
|
190
|
+
next
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
cap = fetch_capture(num)
|
|
194
|
+
if cap.nil?
|
|
195
|
+
warn "No capture at offset #{num}."
|
|
196
|
+
exit 1
|
|
197
|
+
end
|
|
198
|
+
print cap.path
|
|
174
199
|
end
|
|
175
200
|
end
|
data/lib/hiiro/version.rb
CHANGED