bigass changes
- ls beginnings, - added groups to shellstate - made buffers optional in result factory functions, - made an enum signal map, - fixed a minor bug in path resolver that didnt output the '/' if the inode was at root (inode 0) from the moment it was called - added code that attaches the shell to the built-in IDE terminal -- tests need fixing, new code needs testing
This commit is contained in:
+1
-15
@@ -10,7 +10,6 @@ import {
|
||||
type PermissionDeniedError,
|
||||
type ShellError,
|
||||
} from "@core/util/errors";
|
||||
import { createImmutableBuffer } from "@core/util/immutable_buffer";
|
||||
import { resolveInode, resolvePath } from "@core/util/path_resolver";
|
||||
|
||||
export const COMMAND_NAME = "cd";
|
||||
@@ -28,8 +27,6 @@ async function main(
|
||||
"InvalidArguments",
|
||||
"The maximum ammount of arguments for this command is 1",
|
||||
{ expected: "cd <path>", actual: `cd ${args.toString().replace(/[,]/g, " ")}` },
|
||||
createImmutableBuffer(new Uint8Array()),
|
||||
createImmutableBuffer(new Uint8Array()),
|
||||
COMMAND_NAME,
|
||||
),
|
||||
} satisfies CommandOutput<InvalidArgumentsError>;
|
||||
@@ -51,8 +48,6 @@ async function main(
|
||||
"PathResolutionError",
|
||||
"No such file or directory",
|
||||
{ path: args[0]! },
|
||||
createImmutableBuffer(new Uint8Array()),
|
||||
createImmutableBuffer(new Uint8Array()),
|
||||
COMMAND_NAME,
|
||||
),
|
||||
} satisfies CommandOutput<PathResolutionError>;
|
||||
@@ -67,8 +62,6 @@ async function main(
|
||||
"PathResolutionError",
|
||||
"No such file or directory",
|
||||
{ path: resolveInode(state.filesystem, inode) },
|
||||
createImmutableBuffer(new Uint8Array()),
|
||||
createImmutableBuffer(new Uint8Array()),
|
||||
COMMAND_NAME,
|
||||
),
|
||||
} satisfies CommandOutput<PathResolutionError>;
|
||||
@@ -77,14 +70,7 @@ async function main(
|
||||
if (!state.filesystem.canExecute(inode, session.user)) {
|
||||
return {
|
||||
state,
|
||||
result: createErrorResult(
|
||||
"PermissionDenied",
|
||||
"Permission denied",
|
||||
{ resource: args[0]! },
|
||||
createImmutableBuffer(new Uint8Array()),
|
||||
createImmutableBuffer(new Uint8Array()),
|
||||
COMMAND_NAME,
|
||||
),
|
||||
result: createErrorResult("PermissionDenied", "Permission denied", { resource: args[0]! }, COMMAND_NAME),
|
||||
} satisfies CommandOutput<PermissionDeniedError>;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user