Skip to documentation
SLOP

tiny.smg.command.diff

Reference tiny.smg command diff

Defined in command.

API (1)

Actions

Public operations.

No direct callersNo direct callscommanddiff
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Called byCallsNo direct callersdiffgraphsdiffloadGraphFromGitdifftoJsondifftoTextcommand.diffrun
Static calls · unresolved targets: 0 · external targets: 12.

Source: tools/smg/src/command/diff.zig

zig
const std = @import("std");const smg = @import("../root.zig");const diff = smg.diff;const graph_mod = smg.graph;const cli_options = smg.cli.options;const cli_output = smg.cli.output;const cli_session = smg.command.session;const cli_validation = smg.cli.validation;pub fn run(allocator: std.mem.Allocator, phases: std.mem.Allocator, args: []const []const u8, limits: smg.Limits, boundary: cli_session.PhaseBoundary) !u8 {    if (try cli_validation.rejectMissingOptionValues(allocator, args, &.{"--format"})) return 2;    if (try cli_validation.rejectUnexpectedOptionsPlain(allocator, "diff", "[OPTIONS] [REF]", args, &.{"--format"})) return 2;    if (try cli_validation.rejectInvalidChoiceOption(allocator, "diff", "[OPTIONS] [REF]", args, "--format", &.{ "text", "json" })) return 2;    const pos = try cli_options.positional(allocator, args);    if (pos.len > 1) {        try cli_output.writeClickUsageError(allocator, "diff", "[OPTIONS] [REF]", try cli_validation.unexpectedArgumentMessage(allocator, pos[1..]));        return 2;    }    const loaded = try cli_session.loadRead(allocator, phases, limits, boundary);    defer boundary.beginTeardown();    const root = loaded[0];    const graph = loaded[1];    const ref = if (pos.len == 0) "HEAD" else pos[0];    var invalid = false;    const old_graph_optional = try diff.loadGraphFromGit(allocator, root, ref, &invalid, limits);    if (invalid) {        try cli_output.writeErrFmt(allocator, "Error: invalid git ref: {s}\n", .{ref});        return 2;    }    const old_missing = old_graph_optional == null;    const old_graph = old_graph_optional orelse graph_mod.init(allocator);    const result = try diff.graphs(allocator, old_graph, graph, true);    if (cli_options.hasJson(args)) return try cli_output.writeOut(try diff.toJson(allocator, result, ref));    return try cli_output.writeOut(try diff.toText(allocator, result, ref, old_missing));}

Source: tools/smg/src/command/root.zig:11

zig
pub const diff = @import("diff.zig");

Audit

Definitions2
Public names2
Members0
Version26.7.0
Revisiondaab053ee433