this repo has no description
56
fork

Configure Feed

Select the types of activity you want to include in your feed.

icons: allow icons in short mode

+16 -3
+16 -3
src/main.zig
··· 235 235 fn printShort(cmd: Command, writer: anytype) !void { 236 236 const colors = cmd.opts.colors; 237 237 for (cmd.entries) |entry| { 238 + if (cmd.opts.useIcons()) { 239 + const icon = Icon.get(entry, cmd.opts); 240 + 241 + if (cmd.opts.useColor()) { 242 + try writer.writeAll(icon.color); 243 + try writer.writeAll(icon.icon); 244 + try writer.writeAll(colors.reset); 245 + } else { 246 + try writer.writeAll(icon.icon); 247 + } 248 + 249 + try writer.writeByte(' '); 250 + } 238 251 switch (entry.kind) { 239 252 .directory => try writer.writeAll(colors.dir), 240 253 .sym_link => try writer.writeAll(colors.symlink), ··· 315 328 } 316 329 317 330 if (cmd.opts.useIcons()) { 318 - const icon = Icon.get(entry); 331 + const icon = Icon.get(entry, cmd.opts); 319 332 320 333 if (cmd.opts.useColor()) { 321 334 try writer.writeAll(icon.color); ··· 743 756 .{ "zon", Icon.zig }, 744 757 }); 745 758 746 - fn get(entry: Entry) Icon { 759 + fn get(entry: Entry, opts: Options) Icon { 747 760 // 1. By name 748 761 // 2. By extension 749 762 // 3. By type ··· 767 780 }, 768 781 .named_pipe => return pipe, 769 782 .sym_link => { 770 - if (posix.S.ISDIR(entry.statx.mode)) { 783 + if (opts.long and posix.S.ISDIR(entry.statx.mode)) { 771 784 return symlink_dir; 772 785 } 773 786 return symlink;