4d8f6c23e57c

give every command on the help screen its own paragraph (3.0.94)

time
2026-09-27 14:57 UTC · 2 weeks ago
machine
Junes-MacBook-Pro.local
agent
deepseek/deepseek-flash
session
koh3 help and history
parent
4259fb5dff46
4 files VERSION+1 −1src/cli/cli.v+15 −24tests/cli_test.v+13 −3v.mod+1 −1
VERSION+1 −1
@@ -1 +1 @@1-3.0.931+3.0.94

view file

src/cli/cli.v+15 −24
@@ -14,33 +14,24 @@1414 // colour follows NO_COLOR, KOH_NO_COLOR and whether the output is a terminal.1515 // Flags are not shown here: `koh man <command>` documents every one.1616 pub fn usage_text() string {17-	groups := [18-		[19-			['save', 'snapshot your work'],20-			['checkpoint', 'mark a place to come back to'],21-			['status', 'what changed'],22-			['view', 'browse saves and checkpoints'],23-			['diff', 'show changes'],24-		],25-		[26-			['undo', 'step back'],27-			['revert', 'throw away unsaved changes'],28-			['load', 'go to any save'],29-		],30-		[31-			['offer', 'send to your remote'],32-			['steal', 'bring in from your remote'],33-		],17+	commands := [18+		['save', 'snapshot your work'],19+		['checkpoint', 'mark a place to come back to'],20+		['status', 'what changed'],21+		['view', 'browse saves and checkpoints'],22+		['diff', 'show changes'],23+		['undo', 'step back'],24+		['revert', 'throw away unsaved changes'],25+		['load', 'go to any save'],26+		['offer', 'send to your remote'],27+		['steal', 'bring in from your remote'],3428 	]3529 	mut text := '${fmt.light('koh ${version} — version control for the solo developer')}\n'36-	for group in groups {37-		text += '\n'38-		for row in group {39-			text += '  ${fmt.gold(row[0])}${' '.repeat(12 - row[0].len)}${fmt.muted(row[1])}\n'40-		}30+	// A blank line between commands, so the eye lands on one line at a time, and31+	// the list grows as commands land.32+	for row in commands {33+		text += '\n  ${fmt.gold(row[0])}${' '.repeat(12 - row[0].len)}${fmt.muted(row[1])}\n'4134 	}42-	// The list grows as commands land, and the screen keeps to 80 columns, so it43-	// wraps rather than running off the edge.4435 	text += '\n  ${fmt.dim('also: remote · flag · pluck · peek · build · update')}\n'4536 	text += '        ${fmt.dim('init · doctor · strip · migrate')}\n'4637 	text += '\n  ${fmt.dim('koh man <command>  for options and examples')}\n'

view file

tests/cli_test.v+13 −3
@@ -233,15 +233,25 @@233233 	defer { os.rmdir_all(dir) or {} }234234 	help := run(dir, '--help')235235 	assert help.code == 0236-	for name in ['save', 'checkpoint', 'status', 'view', 'diff', 'undo', 'revert', 'load', 'offer',237-		'steal'] {236+	names := ['save', 'checkpoint', 'status', 'view', 'diff', 'undo', 'revert', 'load', 'offer',237+		'steal']238+	for name in names {238239 		assert help.out.contains('  ${name} '), name239240 	}240241 	assert help.out.contains('koh man <command>')241242 	// No flag text anywhere on the screen.242243 	assert !help.out.contains('--'), help.out243-	for line in help.out.split_into_lines() {244+	lines := help.out.split_into_lines()245+	for line in lines {244246 		assert line.runes().len <= 80, line247+	}248+	// Each command has its own paragraph, a blank line above it.249+	for name in names {250+		for i, line in lines {251+			if line.starts_with('  ${name} ') {252+				assert i > 0 && lines[i - 1] == '', line253+			}254+		}245255 	}246256 	// A bare `koh` keeps its stream and exit code; `-h` shows the same screen.247257 	bare := run(dir)

view file

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

view file