| ... | ... | @@ -59,32 +59,42 @@ pub fn execute(args: [][]u8) !void { |
| 59 | 59 | try tracking_list.append(item); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | const stdout = std.io.getStdOut(); |
| 63 | const istty = stdout.isTty(); |
| 64 | const writer = stdout.writer(); |
| 65 | const Bold = if (!istty) "" else style.Bold; |
| 66 | const Faint = if (!istty) "" else style.Faint; |
| 67 | const ResetIntensity = if (!istty) "" else style.ResetIntensity; |
| 68 | |
| 62 | 69 | var first = true; |
| 63 | 70 | var iter = map.iterator(); |
| 64 | 71 | while (iter.next()) |entry| { |
| 65 | 72 | if (!first) std.debug.print("\n", .{}); |
| 66 | 73 | first = false; |
| 67 | | std.debug.print(style.Bold ++ "{s}:\n", .{entry.key_ptr.*}); |
| 74 | try writer.writeAll(Bold); |
| 75 | try writer.print("{s}:\n", .{entry.key_ptr.*}); |
| 68 | 76 | if (u.list_contains(licenses.spdx, entry.key_ptr.*)) { |
| 69 | | std.debug.print(style.Faint ++ "= {s}{s}\n", .{ "https://spdx.org/licenses/", entry.key_ptr.* }); |
| 77 | try writer.writeAll(Faint); |
| 78 | try writer.print("= {s}{s}\n", .{ "https://spdx.org/licenses/", entry.key_ptr.* }); |
| 70 | 79 | } |
| 71 | | std.debug.print(style.ResetIntensity, .{}); |
| 80 | try writer.writeAll(ResetIntensity); |
| 72 | 81 | for (entry.value_ptr.*.items) |item| { |
| 73 | 82 | if (std.mem.eql(u8, item.clean_path, "../..")) { |
| 74 | | std.debug.print("- This\n", .{}); |
| 83 | try writer.print("- This\n", .{}); |
| 75 | 84 | } else { |
| 76 | | std.debug.print("- {s} {s}\n", .{ @tagName(item.dep.?.type), item.dep.?.path }); |
| 85 | try writer.print("- {s} {s}\n", .{ @tagName(item.dep.?.type), item.dep.?.path }); |
| 77 | 86 | } |
| 78 | 87 | } |
| 79 | 88 | } |
| 80 | 89 | if (unspecified_list.items.len > 0) { |
| 81 | | std.debug.print(style.Bold ++ "Unspecified:\n", .{}); |
| 82 | | std.debug.print(style.ResetIntensity, .{}); |
| 90 | try writer.writeAll(Bold); |
| 91 | try writer.print("Unspecified:\n", .{}); |
| 92 | try writer.writeAll(ResetIntensity); |
| 83 | 93 | for (unspecified_list.items) |item| { |
| 84 | 94 | if (std.mem.eql(u8, item.clean_path, "../..")) { |
| 85 | | std.debug.print("- This\n", .{}); |
| 95 | try writer.print("- This\n", .{}); |
| 86 | 96 | } else { |
| 87 | | std.debug.print("- {s} {s}\n", .{ @tagName(item.dep.?.type), item.dep.?.path }); |
| 97 | try writer.print("- {s} {s}\n", .{ @tagName(item.dep.?.type), item.dep.?.path }); |
| 88 | 98 | } |
| 89 | 99 | } |
| 90 | 100 | } |