50 lines
841 B
TypeScript
50 lines
841 B
TypeScript
import type { Stack } from '$lib/stores/stack';
|
|
import type { Command } from './command';
|
|
import type { Process } from './process';
|
|
|
|
export class Shell {
|
|
private _passwd: User[];
|
|
private _group: Group[];
|
|
|
|
private _commands: Command[];
|
|
|
|
private _userSessions: Stack<User>;
|
|
|
|
private user: User;
|
|
private _process?: Process;
|
|
|
|
constructor() {}
|
|
|
|
public static Initialize(
|
|
username: string,
|
|
password: string,
|
|
commands: Map<string, Command>,
|
|
passwd: Map<number, User>,
|
|
group: Map<number, Group>
|
|
) {}
|
|
}
|
|
|
|
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[];
|
|
};
|