tiny.tracy.cli.args.summary
Defined in cli.args.
API (1)
Actions
Public operations.
Source
Source: lib/tracy/src/cli/args/root.zig:3
zig
pub const summary = @import("summary.zig");Source: lib/tracy/src/cli/args/summary.zig
zig
const std = @import("std");const scalar = @import("scalar.zig");const types = @import("types.zig");pub fn parse(args: []const []const u8) !types.SummaryArgs { if (args.len == 0) return error.InvalidArguments; var parsed = types.SummaryArgs{ .path = args[0] }; var index: usize = 1; while (index < args.len) : (index += 1) { if (std.mem.eql(u8, args[index], "--format")) { index += 1; if (index >= args.len) return error.InvalidArguments; if (std.mem.eql(u8, args[index], "text")) { parsed.format = .text; } else if (std.mem.eql(u8, args[index], "jsonl")) { parsed.format = .jsonl; } else { return error.UnsupportedFormat; } } else if (std.mem.eql(u8, args[index], "--top")) { index += 1; if (index >= args.len) return error.InvalidArguments; parsed.options.top = try scalar.parsePositiveUsize(args[index]); } else { return error.UnknownArgument; } } return parsed;}test "summary args parse format and limit" { const parsed = try parse(&.{ "events.jsonl", "--format", "jsonl", "--top", "8" }); try std.testing.expectEqualStrings("events.jsonl", parsed.path); try std.testing.expectEqual(types.Format.jsonl, parsed.format); try std.testing.expectEqual(@as(usize, 8), parsed.options.top);}Audit
| Definitions | 2 |
|---|---|
| Public names | 2 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |