Remove useless code and comments.
This commit is contained in:
parent
98d88e8cd4
commit
cc71aaf6a2
1 changed files with 2 additions and 26 deletions
28
src/ls.zig
28
src/ls.zig
|
@ -10,36 +10,12 @@ const fmt = std.fmt;
|
||||||
const Kind = std.fs.File.Kind;
|
const Kind = std.fs.File.Kind;
|
||||||
const PermissionsUnix = std.fs.File.PermissionsUnix;
|
const PermissionsUnix = std.fs.File.PermissionsUnix;
|
||||||
|
|
||||||
// // /absolute/path/file => fpath + sep + entry.name
|
|
||||||
// std.mem.copy (u8, fullname[0..], fpath);
|
|
||||||
// fullname[fpath.len] = path.sep; // '/' on Unix-like systems, '\' on Windows.
|
|
||||||
// std.mem.copy (u8, fullname[fpath.len+1..], entry.name);
|
|
||||||
// try print_file(fullname[0..fpath.len+1+entry.name.len]);
|
|
||||||
|
|
||||||
// Stats
|
|
||||||
// .size = @bitCast(u64, info.StandardInformation.EndOfFile),
|
|
||||||
// .mode = 0,
|
|
||||||
// .atime = LastAccessTime
|
|
||||||
// .mtime = LastWriteTime
|
|
||||||
// .ctime = CreationTime
|
|
||||||
|
|
||||||
|
|
||||||
// WON'T: human output => use human command instead
|
// WON'T: human output => use human command instead
|
||||||
// TODO: error management.
|
// TODO: error management.
|
||||||
// TODO: verbose output (-l).
|
|
||||||
|
|
||||||
pub const cwd = fs.cwd();
|
pub const cwd = fs.cwd();
|
||||||
|
|
||||||
const Sorting = enum {
|
|
||||||
None,
|
|
||||||
DateCreation, // TODO
|
|
||||||
DateLastAccess, // TODO
|
|
||||||
DateLastWrite, // TODO
|
|
||||||
Size, // TODO
|
|
||||||
};
|
|
||||||
|
|
||||||
const Options = struct {
|
const Options = struct {
|
||||||
sorting: Sorting = Sorting.None,
|
|
||||||
verbose: bool = false,
|
verbose: bool = false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -110,7 +86,8 @@ fn print_file (fpath: []const u8) !void {
|
||||||
}
|
}
|
||||||
|
|
||||||
const dname = path.dirname(fpath);
|
const dname = path.dirname(fpath);
|
||||||
var dir: fs.Dir = cwd.openDir(dname.?, .{}) catch |err| switch (err) {
|
var dpath = dname orelse ".";
|
||||||
|
var dir: fs.Dir = cwd.openDir(dpath, .{}) catch |err| switch (err) {
|
||||||
error.AccessDenied => return lib.print("{s}: access denied\n", .{dname}),
|
error.AccessDenied => return lib.print("{s}: access denied\n", .{dname}),
|
||||||
else => return err,
|
else => return err,
|
||||||
};
|
};
|
||||||
|
@ -124,7 +101,6 @@ fn print_file_in_dir (dir: fs.Dir, entryname: []const u8) !void {
|
||||||
return lib.print("{s}\n", .{entryname});
|
return lib.print("{s}\n", .{entryname});
|
||||||
}
|
}
|
||||||
|
|
||||||
// lib.print("{}\n", .{try dir.statFile(entryname)});
|
|
||||||
return try print_stats (entryname, try dir.fstatat(entryname));
|
return try print_stats (entryname, try dir.fstatat(entryname));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue