Slight improvement to how permissions are applied to folders

unsquashfs Verbose flag
This commit is contained in:
Caleb J. Gardner
2026-02-13 01:35:20 -06:00
parent b22e4d003d
commit b7b99325da
2 changed files with 94 additions and 37 deletions
+6 -1
View File
@@ -16,6 +16,7 @@ const help_mgs =
\\ -o <offset> Start reading the archive at the given offset.
\\
\\ -p <threads> Specify how many threads to use. If no present or zero, the system's logical cores count is used.
\\ -v Verbose
\\
\\ --help Display this messages
\\ --version Display the version
@@ -28,6 +29,7 @@ var archive: []const u8 = "";
var extLoc: []const u8 = "squashfs-root";
var offset: u64 = 0;
var threads: u32 = 0;
var verbose: bool = false;
pub fn main() !void {
const alloc = std.heap.smp_allocator;
@@ -44,7 +46,7 @@ pub fn main() !void {
defer fil.close();
var arc: squashfs.Archive = try .initAdvanced(alloc, fil, offset, threads); //TODO: Update when memory size matters. //TODO: Handle error gracefully.
defer arc.deinit();
try arc.extract(extLoc, .Default); //TODO: Handle error gracefully.
try arc.extract(extLoc, if (verbose) .VerboseDefault(&out.interface) else .Default); //TODO: Handle error gracefully.
}
fn handleArgs(alloc: std.mem.Allocator, out: *Writer) !void {
@@ -82,6 +84,9 @@ fn handleArgs(alloc: std.mem.Allocator, out: *Writer) !void {
return errors.InvalidArguments;
};
continue;
} else if (std.mem.eql(u8, arg, "-v")) {
verbose = true;
continue;
} else if (std.mem.eql(u8, arg, "--version")) {
try out.print("zig-unsquashfs v", .{});
try config.version.format(out);