tiny.smg.command.batch
Defined in command.
API (1)
Actions
Public operations.
Source
Source: tools/smg/src/command/batch.zig
zig
const std = @import("std");const smg = @import("../root.zig");const batch = smg.batch;const cli_options = smg.cli.options;const cli_output = smg.cli.output;const cli_session = smg.command.session;pub fn run( allocator: std.mem.Allocator, phases: std.mem.Allocator, args: []const []const u8, limits: smg.Limits,) !u8 { const root = try smg.storage.requireRoot(allocator); var storage = try smg.BatchInputStorage.init(phases, limits.batch_input); defer storage.deinit(phases); storage.activate(); var stdin_buffer: [8192]u8 = undefined; var reader = std.Io.File.stdin().reader(std.Options.debug_io, &stdin_buffer); const input = storage.read(&reader.interface) catch |err| switch (err) { error.ReadFailed => return reader.err.?, error.BatchInputCapacityExceeded => return error.StreamTooLong, else => |other| return other, }; defer storage.release(); const loaded = try cli_session.loadMutationAt(allocator, phases, root, limits); var graph = loaded.graph; const result = try batch.process(allocator, &graph, input); try smg.storage.graph.publish(phases, loaded.root, graph, loaded.head, limits); if (std.mem.eql(u8, cli_options.flagValue(args, "--format") orelse "", "json")) return try cli_output.writeOut(try batch.renderJson(allocator, result)); return try cli_output.writeOut(try batch.renderText(allocator, result));}Source: tools/smg/src/command/root.zig:3
zig
pub const batch = @import("batch.zig");Audit
| Definitions | 2 |
|---|---|
| Public names | 2 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |