cd fixed and cleaned up. Shell started, needs data fetching code to initialize properly, added the approperiate db_manager file to implement that.

This commit is contained in:
2026-08-08 08:11:19 +02:00
parent 394e0b9e7c
commit 0149937526
3 changed files with 74 additions and 24 deletions
+20 -24
View File
@@ -32,30 +32,26 @@ function main(state: ShellState, __flags: string[], args: string[]): CommandOutp
let inode: number;
const session = getCurrentSession(state);
switch (args[0]) {
case undefined:
inode = session.user.home;
break;
case "-":
inode = session.pwd;
break;
default:
const result = safeResolvePath(state.filesystem, session.cwd, args[0]);
if (result.type === "error") {
return {
state,
result: createErrorResult(
"PathResolutionError",
"No such file or directory",
{ path: args[0]! },
createImmutableBuffer(new Uint8Array()),
createImmutableBuffer(new Uint8Array()),
COMMAND_NAME,
),
} satisfies CommandOutput<PathResolutionError>;
}
inode = result.inode;
break;
if (args[0] === undefined) {
inode = session.user.home;
} else if (args[0] === "-") {
inode = session.pwd;
} else {
const result = safeResolvePath(state.filesystem, session.cwd, args[0]);
if (result.type === "error") {
return {
state,
result: createErrorResult(
"PathResolutionError",
"No such file or directory",
{ path: args[0]! },
createImmutableBuffer(new Uint8Array()),
createImmutableBuffer(new Uint8Array()),
COMMAND_NAME,
),
} satisfies CommandOutput<PathResolutionError>;
}
inode = result.inode;
}
if (state.filesystem.isFile(inode)) {