- chunking fixed
- bug with recursive ls looping fixed
- bug with empty directories on ls -a failing fixed
This commit is contained in:
2026-09-06 02:48:11 +02:00
parent b75e691a0b
commit e2ade5de29
3 changed files with 17 additions and 18 deletions
+10 -11
View File
@@ -210,24 +210,23 @@ async function main(io: CommandIO, state: ShellState, args: string[]): Promise<C
const session = getCurrentSession(state);
// This needs fixing, separate paths into a separate array from args
if (paths.length === 0) {
entries.push({ inode: session.cwd, path: "." });
} else {
for (const arg of args) {
const inode = resolvePath(state, arg);
for (const path of paths) {
const inode = resolvePath(state, path);
if (inode === -1) {
return {
state,
result: createErrorResult(
"PathResolutionError",
`No such file or directory`,
{ path: arg },
{ path },
COMMAND_NAME,
),
};
}
entries.push({ inode: inode, path: arg });
entries.push({ inode: inode, path });
}
}
@@ -259,8 +258,8 @@ async function main(io: CommandIO, state: ShellState, args: string[]): Promise<C
if (!options.all && !options.almostAll) children = children.filter(c => !c.name.startsWith("."));
if (options.long) {
longMode(io, state, children);
//io.writeStdout(e.encode("\n"));
longMode(io, state, children, node);
if (options.recursive) io.writeStdout(e.encode("\n"));
}
if (options.recursive) {
@@ -278,18 +277,18 @@ async function main(io: CommandIO, state: ShellState, args: string[]): Promise<C
}
}
function longMode(io: CommandIO, state: ShellState, nodes: TreeNode[]): void {
function longMode(io: CommandIO, state: ShellState, children: TreeNode[], current: TreeNode): void {
const e = new TextEncoder();
const buff: Uint8Array[] = [];
const nodes: TreeNode[] = [...children];
if (options.all) {
const cwdNode = state.filesystem.getNode(nodes[0]!.parent)!;
const parentNode = state.filesystem.getNode(cwdNode.parent)!;
const parentNode = state.filesystem.getNode(current.parent)!;
const parent: TreeNode = { ...parentNode, name: ".." };
nodes.unshift(parent);
const cwd: TreeNode = { ...cwdNode, name: "." };
const cwd: TreeNode = { ...current, name: "." };
nodes.unshift(cwd);
}