a bit of front-end work, changing users almost done on login, "drunk-code" no more (id hope), continuous processes and keybinds still not done.

This commit is contained in:
2026-03-19 17:52:36 +01:00
parent 18aeeb200f
commit c3f1af6818
14 changed files with 136 additions and 62 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

+2 -9
View File
@@ -73,6 +73,8 @@ export class Bash {
command,
args
);
//this._terminal.isProcessActive = true;
}
private _appendNewResult(inode: number, output: any, cmd: string) {
@@ -168,15 +170,6 @@ export class Bash {
return out;
}
processKill(): ExitCode {
if(this._process) {
return this._process.sigKill(() => {console.log("process Kill successfull")});
}
else {
return ExitCode.SUCCESS; //Temp need to make custom enum value
}
}
throwError(result: Result): void {
switch (result.exitCode) {
default: {
+4 -3
View File
@@ -1,12 +1,13 @@
import { isBuildCommand } from "typescript";
import type { KeyBind } from "../terminal/keybindRegistry";
import type { Bash, Result } from "./bash";
import { cd } from "./commands/cd";
import { clear } from "./commands/clear";
import { ls } from "./commands/ls";
import { aSync } from "./commands/testAsync";
import { testProcess } from "./commands/testAsync";
export type ICommand = {
method: (this: Bash, args: CommandArgs) => Promise<Result>;
method: (this: Bash, args: CommandArgs) => Result;
keybinds?: Map<KeyBind, () => any>;
flags: string[];
help: string;
@@ -28,7 +29,7 @@ export const COMMANDS = {
cd,
ls,
clear,
aSync
testProcess
} as const satisfies Record<string, ICommand>;
/* //export const commands {
+9 -28
View File
@@ -38,7 +38,7 @@ const months: readonly string[] = [
'Dec'
];
export const cmd_ls = async function (this: Bash, args: CommandArgs): Promise<Result> {
export const cmd_ls = function (this: Bash, args: CommandArgs): Result {
const Fs = this.getFs();
const resultData: CommandResultData = { cmd: 'ls', data: null, args: args };
const result: Result = { exitCode: ExitCode.ERROR, path: this.getCwd(), resultData: resultData };
@@ -80,16 +80,16 @@ function result_ls(this: Bash, data: any, args: CommandArgs): HTMLElement {
const f_a: boolean = flagInfo.has('a') || flagInfo.has('all');
const f_A: boolean = flagInfo.has('A') || flagInfo.has('almost-all');
const f_G: boolean = flagInfo.has('G') || flagInfo.has('no-group');
//const f_G: boolean = flagInfo.has('G') || flagInfo.has('no-group');
const f_h: boolean = flagInfo.has('h') || flagInfo.has('human-readable');
const f_r: boolean = flagInfo.has('r') || flagInfo.has('reverse');
const f_R: boolean = flagInfo.has('R') || flagInfo.has('recursive');
const f_Q: boolean = flagInfo.has('Q') || flagInfo.has('quote-name');
const f_n: boolean = flagInfo.has('n') || flagInfo.has('numeric-uid-gid');
const f_N: boolean = flagInfo.has('N') || flagInfo.has('literal');
const f_L: boolean = flagInfo.has('L') || flagInfo.has('dereference');
//const f_Q: boolean = flagInfo.has('Q') || flagInfo.has('quote-name');
//const f_n: boolean = flagInfo.has('n') || flagInfo.has('numeric-uid-gid');
//const f_N: boolean = flagInfo.has('N') || flagInfo.has('literal');
//const f_L: boolean = flagInfo.has('L') || flagInfo.has('dereference');
const f_i: boolean = flagInfo.has('i') || flagInfo.has('inode');
const f_help: boolean = flagInfo.has('help');
//const f_help: boolean = flagInfo.has('help');
const f_si: boolean = flagInfo.has('si');
const f_X: boolean = flagInfo.has('X');
const f_S: boolean = flagInfo.has('S');
@@ -278,8 +278,8 @@ function isValidNodeTimestamp(value: string): value is SortNodeBy.ATIME | SortNo
function parsePerms(perms: NodePerms): string {
const parts: string[] = [];
//for each key (key representing key name and p representing the key contents) of entries in perms as types keyof NodePerms and Permission
for (const [key, p] of Object.entries(perms) as [keyof NodePerms, Permission][]) {
const perms: string = `${p.r ? 'r' : '-'}${p.w ? 'w' : '-'}${p.x ? 'x' : '-'}`;
for (const [, permission] of Object.entries(perms) as [keyof NodePerms, Permission][]) {
const perms: string = `${permission.r ? 'r' : '-'}${permission.w ? 'w' : '-'}${permission.x ? 'x' : '-'}`;
parts.push(perms);
}
return parts.join('');
@@ -371,25 +371,6 @@ function formatName(node: TreeNode, flag: any, shouldShift: boolean) {
return flag.has('p') && node.type === Type.Directory ? `${name}/` : name;
}
/* function formatOutputShort(node: TreeNode, flag: any) {
let output: string = node.name;
const char: string = flag.has('Q') ? '"' : "'";
if (/\s/.test(node.name)) {
if(flag.has('i')) {
}
else {
output = `${char}${node.name}${char}`;
}
if(flag.has('i')) {
output = `${node.inode} ${output}`
}
return flag.has('p') && node.type === Type.Directory ? ` ${output}/ ` : output;
} */
const checkFlags = (pFlags: string[]) => {
const flagSet = new Set(pFlags);
+9 -5
View File
@@ -1,12 +1,16 @@
import type { KeyBind } from "$lib/stores/terminal/keybindRegistry";
import { mount } from "svelte";
import { type Bash, type Result } from "../bash";
import type { CommandArgs, ICommand } from "../commandRegistry";
import type { CommandArgs, CommandResultData, ICommand } from "../commandRegistry";
import { ExitCode } from "../metadata";
import Login from "../../../../modules/Login.svelte";
import Loading from "../../../../modules/Loading.svelte";
export const cmd_async = async function(this: Bash, args: CommandArgs): Promise<Result> {
export const cmd_process = function(this: Bash, args: CommandArgs): Result {
let result: Result = { exitCode: ExitCode.ERROR, path: this.getCwd() };
const resultData: CommandResultData = { cmd: 'ls', data: null, args: args };
result.resultData = resultData;
result.exitCode = ExitCode.SUCCESS;
return result;
}
@@ -28,8 +32,8 @@ const keybinds: Map<KeyBind, () => any> = new Map([
[test_keybind,test]
]);
export const aSync: ICommand = {
method: cmd_async,
export const testProcess: ICommand = {
method: cmd_process,
keybinds: keybinds,
flags: [] as string[],
help: 'PATH TO HELP.md',
+1 -1
View File
@@ -67,7 +67,7 @@ export class Process {
}
private async _Run(command: ICommand, bashInstance: Bash, args: CommandArgs) {
this._result = await command.method.call(
this._result = command.method.call(
bashInstance, args);
}
+7 -2
View File
@@ -1,3 +1,4 @@
import type { BooleanLiteral } from 'typescript';
import { Bash, Signal, type BashInitArgs, type Result } from '../bash/bash';
import type { CommandArgs } from '../bash/commandRegistry';
import type { User } from '../bash/etc/userData';
@@ -5,7 +6,7 @@ import { VirtualFS, type TreeNode } from '../bash/fs';
import { KeybindInhibitor } from '../bash/keybindInhibitor';
import { ExitCode } from '../bash/metadata';
import type { Process } from '../bash/process';
import { TERMINAL_KEYBINDS, type KeyStroke } from './keybindRegistry';
import { TERMINAL_KEYBINDS, type KeyBind } from './keybindRegistry';
//import type { ILocale } from './localeRegistry';
export type TerminalMode = {};
@@ -37,13 +38,15 @@ export class Terminal {
private _bash: Bash;
private _callbacks: Partial<PageCallbacks> = {};
private _keybindInhibitor: KeybindInhibitor;
//public isProcessActive: boolean = false;
//public locale: ILocale;
constructor(args: TermInitArgs) {
args.bash.io = this;
this._bash = new Bash(args.bash);
const keybinds: Map<KeyStroke, () => any> = new Map([
const keybinds: Map<KeyBind, () => any> = new Map([
[TERMINAL_KEYBINDS.sigint,this._processKill]
]);
@@ -62,6 +65,8 @@ export class Terminal {
console.log("process kill successful");
});
//this.isProcessActive = false;
return result;
}