| ... | @@ -1,5 +1,6 @@ | ... | @@ -1,5 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const gpa = std.heap.c_allocator; | 2 | const gpa = std.heap.c_allocator; |
| | 3 | const string = []const u8; |
| 3 | const style = @import("ansi").style; | 4 | const style = @import("ansi").style; |
| 4 | const licenses = @import("licenses"); | 5 | const licenses = @import("licenses"); |
| 5 | const extras = @import("extras"); | 6 | const extras = @import("extras"); |
| ... | @@ -24,7 +25,12 @@ pub fn execute(args: [][]u8) !void { | ... | @@ -24,7 +25,12 @@ pub fn execute(args: [][]u8) !void { |
| 24 | .update = false, | 25 | .update = false, |
| 25 | .alloc = gpa, | 26 | .alloc = gpa, |
| 26 | }; | 27 | }; |
| 27 | const top_module = try common.collect_deps_deep(cachepath, dir, &options); | 28 | |
| | 29 | try do(cachepath, dir, &options, std.io.getStdOut()); |
| | 30 | } |
| | 31 | |
| | 32 | pub fn do(cachepath: string, dir: std.fs.Dir, options: *common.CollectOptions, outfile: std.fs.File) !void { |
| | 33 | const top_module = try common.collect_deps_deep(cachepath, dir, options); |
| 28 | | 34 | |
| 29 | var master_list = List.init(gpa); | 35 | var master_list = List.init(gpa); |
| 30 | errdefer master_list.deinit(); | 36 | errdefer master_list.deinit(); |
| ... | @@ -63,9 +69,8 @@ pub fn execute(args: [][]u8) !void { | ... | @@ -63,9 +69,8 @@ pub fn execute(args: [][]u8) !void { |
| 63 | try tracking_list.append(item); | 69 | try tracking_list.append(item); |
| 64 | } | 70 | } |
| 65 | | 71 | |
| 66 | const stdout = std.io.getStdOut(); | 72 | const istty = outfile.isTty(); |
| 67 | const istty = stdout.isTty(); | 73 | const writer = outfile.writer(); |
| 68 | const writer = stdout.writer(); | | |
| 69 | const Bold = if (!istty) "" else style.Bold; | 74 | const Bold = if (!istty) "" else style.Bold; |
| 70 | const Faint = if (!istty) "" else style.Faint; | 75 | const Faint = if (!istty) "" else style.Faint; |
| 71 | const ResetIntensity = if (!istty) "" else style.ResetIntensity; | 76 | const ResetIntensity = if (!istty) "" else style.ResetIntensity; |
| ... | @@ -91,6 +96,7 @@ pub fn execute(args: [][]u8) !void { | ... | @@ -91,6 +96,7 @@ pub fn execute(args: [][]u8) !void { |
| 91 | } | 96 | } |
| 92 | } | 97 | } |
| 93 | if (unspecified_list.items.len > 0) { | 98 | if (unspecified_list.items.len > 0) { |
| | 99 | if (!first) try writer.writeAll("\n"); |
| 94 | try writer.writeAll(Bold); | 100 | try writer.writeAll(Bold); |
| 95 | try writer.writeAll("Unspecified:\n"); | 101 | try writer.writeAll("Unspecified:\n"); |
| 96 | try writer.writeAll(ResetIntensity); | 102 | try writer.writeAll(ResetIntensity); |