17c48991c43c

split the print half out of cmd_steal and cmd_status, and note the key table in term (3.2.17)

time
2026-09-29 02:36 UTC · 2 weeks ago
machine
Junes-MacBook-Pro.local
agent
claude-sonnet-5-5
session
comment and tidy pass
parent
4d519567736f
5 files VERSION+1 −1src/cli/cmd_status.v+9 −3src/cli/cmd_steal.v+8 −2src/view/term.v+2 −0v.mod+1 −1
VERSION+1 −1
@@ -1 +1 @@1-3.2.161+3.2.17

view file

src/cli/cmd_status.v+9 −3
@@ -54,7 +54,14 @@5454 		return 05555 	}5656 	saves := history.save_count(store) or { return refuse(false, err.msg()) }57-	note('at [${head.id}] ${fmt.fit(head.message.all_before('\n'), 50)} · ${ago(head.created_at)} · ${fmt.plural(int(saves), 'save')}')57+	print_status(head, changes, unfinished, int(saves))58+	return 059+}60+61+// print_status is the plain-text report: the save you are on, then each changed path with a62+// mark, then the counts.63+fn print_status(head history.Save, changes Changes, unfinished bool, saves int) {64+	note('at [${head.id}] ${fmt.fit(head.message.all_before('\n'), 50)} · ${ago(head.created_at)} · ${fmt.plural(saves, 'save')}')5865 	if unfinished {5966 		warn(snapshot.restore_unfinished)6067 	}@@ -66,7 +73,7 @@6673 		if changes.ignore_changed {6774 			note('${snapshot.ignore_file} changed since [${head.id}]')6875 		}69-		return 076+		return7077 	}7178 	for path in changes.added {7279 		println('  ${fmt.green('+')} ${path}')@@ -81,7 +88,6 @@8188 	if changes.ignore_changed {8289 		warn('${snapshot.ignore_file} changed since [${head.id}] — the next save records the new rules')8390 	}84-	return 08591 }8692 8793 pub struct Changes {

view file

src/cli/cmd_steal.v+8 −2
@@ -104,9 +104,16 @@104104 		}))105105 		return 0106106 	}107+	print_steal(report, guided, read_only, offer_failed)108+	return 0109+}110+111+// print_steal tells the person how a finished steal went: what came in, what the two machines112+// disagreed on, and how to get back.113+fn print_steal(report exchange.StealReport, guided bool, read_only bool, offer_failed bool) {107114 	if report.fetched_saves == 0 {108115 		ok('already up to date with "${report.repo}" — head is [${report.head}]')109-		return 0116+		return110117 	}111118 	if report.forward {112119 		if guided {@@ -147,7 +154,6 @@147154 	if offer_failed {148155 		warn('the remote was not updated — run "koh offer" when it is reachable again')149156 	}150-	return 0151157 }152158 153159 // on_terminal is when a steal asks rather than refuses: a person at both ends, and no --json.

view file

src/view/term.v+2 −0
@@ -73,6 +73,8 @@7373 	return decode(buf[..n])7474 }7575 76+// decode is a key table: one case per byte or escape sequence, nothing carried between reads.77+// It is long because there are many keys.7678 fn decode(bytes []u8) Key {7779 	if bytes.len == 1 {7880 		b := bytes[0]

view file

v.mod+1 −1
@@ -1,6 +1,6 @@11 Module {22 	name: 'koh3'3-	version: '3.2.16'3+	version: '3.2.17'44 	description: 'One SQLite file per repo, one line of history.'55 	license: 'MIT'66 }

view file