44690b82
refactor: drop the comments and cases cliflags now owns
a73x 2026-08-27 06:51
Commit message
src/cli/muxa.zig
| Old | New | ||
|---|---|---|---|
| @@ -263,10 +263,6 @@ test "muxa: --session rides every verb; a bad name is usage, not wire bytes" { | |||
| 263 | // Empty is the wire's default, not a name anyone can mean by typing it. | 263 | // Empty is the wire's default, not a name anyone can mean by typing it. |
| 264 | const empty = [_][:0]const u8{ "muxa", "status", "--session", "" }; | 264 | const empty = [_][:0]const u8{ "muxa", "status", "--session", "" }; |
| 265 | try std.testing.expectError(error.Usage, parseArgs(&empty)); | 265 | try std.testing.expectError(error.Usage, parseArgs(&empty)); |
| 266 | |||
| 267 | // Dangling like every other value-taking flag. | ||
| 268 | const dangling = [_][:0]const u8{ "muxa", "status", "--session" }; | ||
| 269 | try std.testing.expectError(error.Usage, parseArgs(&dangling)); | ||
| 270 | } | 266 | } |
| 271 | 267 | ||
| 272 | test "parseArgs: --quic and --key, and the pairs that make no sense" { | 268 | test "parseArgs: --quic and --key, and the pairs that make no sense" { |
| @@ -283,12 +279,10 @@ test "parseArgs: --quic and --key, and the pairs that make no sense" { | |||
| 283 | try std.testing.expectEqualStrings("/k", ok.key.?); | 279 | try std.testing.expectEqualStrings("/k", ok.key.?); |
| 284 | try std.testing.expectEqualStrings("make test", ok._arg.?); | 280 | try std.testing.expectEqualStrings("make test", ok._arg.?); |
| 285 | 281 | ||
| 286 | // A flag at the end of argv with no value is refused, like every other | 282 | // cliflags owns the arity; what is muxa's is that its refusal becomes |
| 287 | // value-taking flag this parser has. | 283 | // the usage exit and not a dial with a flag's name for a host. |
| 288 | const dangling_q = [_][:0]const u8{ "muxa", "status", "--quic" }; | 284 | const dangling_q = [_][:0]const u8{ "muxa", "status", "--quic" }; |
| 289 | try std.testing.expectError(error.Usage, parseArgs(&dangling_q)); | 285 | try std.testing.expectError(error.Usage, parseArgs(&dangling_q)); |
| 290 | const dangling_k = [_][:0]const u8{ "muxa", "status", "--quic", "b:1", "--key" }; | ||
| 291 | try std.testing.expectError(error.Usage, parseArgs(&dangling_k)); | ||
| 292 | 286 | ||
| 293 | // Two transports named at once: which one an agent's frames went to | 287 | // Two transports named at once: which one an agent's frames went to |
| 294 | // would be this parser's private business, and it is not entitled to | 288 | // would be this parser's private business, and it is not entitled to |
src/cli/webhub_main.zig
| Old | New | ||
|---|---|---|---|
| @@ -138,9 +138,9 @@ comptime { | |||
| 138 | 138 | ||
| 139 | /// A usage mistake is an ERROR, not a third result: it is the one outcome | 139 | /// A usage mistake is an ERROR, not a third result: it is the one outcome |
| 140 | /// with nothing to hand back, and saying so lets the single errdefer own | 140 | /// with nothing to hand back, and saying so lets the single errdefer own |
| 141 | /// the tile list on every refusing path. Spelling it as a value meant a | 141 | /// the tile list on every refusing path. As a value it wanted a |
| 142 | /// `tiles.deinit` beside each of the seven `return .usage_error`s, which | 142 | /// `tiles.deinit` beside every refusing return, each one a chance to |
| 143 | /// is seven chances to forget one. | 143 | /// forget. |
| 144 | const ParseError = error{Usage} || std.mem.Allocator.Error; | 144 | const ParseError = error{Usage} || std.mem.Allocator.Error; |
| 145 | 145 | ||
| 146 | fn parseArgs( | 146 | fn parseArgs( |