WIP: new abstraction layer, file system now a singleton, shell should be too
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import type { Stack } from '$lib/stores/stack';
|
||||
import { FileSystem } from '../filesystem/filesystem';
|
||||
|
||||
export class Shell {
|
||||
private readonly _fs: FileSystem;
|
||||
|
||||
private _passwd: User[];
|
||||
private _group: Group[];
|
||||
|
||||
private _commands: Command[];
|
||||
|
||||
private _userSessions: Stack<User>;
|
||||
|
||||
private user: User;
|
||||
private _process?: Process;
|
||||
|
||||
constructor() {
|
||||
this._fs = new FileSystem();
|
||||
}
|
||||
}
|
||||
|
||||
export enum ExitCode {
|
||||
OK = 0,
|
||||
ERR = 1,
|
||||
INT = 2
|
||||
}
|
||||
|
||||
export type User = {
|
||||
username: string;
|
||||
password: string;
|
||||
readonly uid: number;
|
||||
readonly gid: number;
|
||||
home: string;
|
||||
accessible: boolean;
|
||||
history: string;
|
||||
cwd?: number;
|
||||
pwd?: number;
|
||||
};
|
||||
|
||||
export type Group = {
|
||||
groupname: string;
|
||||
gid: number;
|
||||
members: number[];
|
||||
};
|
||||
Reference in New Issue
Block a user