cli: list-themes should list symlinks

Symbolic links should be listed in addition to normal files. Useful
for system like home-manager that link config files to location in the
Nix store.
This commit is contained in:
Jeffrey C. Ollie
2024-09-24 10:28:49 -05:00
committed by Mitchell Hashimoto
parent 743e547235
commit a6a4f9ff8e

View File

@ -114,13 +114,17 @@ pub fn run(gpa_alloc: std.mem.Allocator) !u8 {
var walker = dir.iterate(); var walker = dir.iterate();
while (try walker.next()) |entry| { while (try walker.next()) |entry| {
if (entry.kind != .file) continue; switch (entry.kind) {
count += 1; .file, .sym_link => {
try themes.append(.{ count += 1;
.location = loc.location, try themes.append(.{
.path = try std.fs.path.join(alloc, &.{ loc.dir, entry.name }), .location = loc.location,
.theme = try alloc.dupe(u8, entry.name), .path = try std.fs.path.join(alloc, &.{ loc.dir, entry.name }),
}); .theme = try alloc.dupe(u8, entry.name),
});
},
else => {},
}
} }
} }