2022-06-12 09:38:38 +02:00
|
|
|
function man(args: Array<string>):string{
|
|
|
|
var buf = "";
|
|
|
|
if(args.length == 0){
|
|
|
|
buf += "Missing arguments"
|
|
|
|
}
|
|
|
|
switch (args[0]){
|
|
|
|
case "help":
|
|
|
|
buf += "\'help\' Prints the list of available commands\n";
|
|
|
|
break;
|
|
|
|
case "clear":
|
|
|
|
buf += "\'clear\' Clears the console\n";
|
|
|
|
break;
|
|
|
|
case "ls":
|
|
|
|
buf += "\'ls\' Lists the files in the current directory, also displays if file or directory\n";
|
|
|
|
break;
|
|
|
|
case "cd":
|
|
|
|
buf += "\'cd (dirname/..)\' Changes the current directory\n";
|
|
|
|
break;
|
|
|
|
case "echo":
|
|
|
|
buf += "\'echo (arg1) (arg2) .....\' Prints the arguments to the console\n";
|
|
|
|
break;
|
|
|
|
case "mkdir":
|
|
|
|
buf += "\'mkdir (dirname)\' Creates a new directory in the current directory\n";
|
|
|
|
break;
|
|
|
|
case "cat":
|
|
|
|
buf += "\'cat (filename)\' Prints the contents of a file out to the console\n";
|
|
|
|
break;
|
|
|
|
case "touch":
|
|
|
|
buf += "\'touch (filename)\' Creates a new file in the current directory\n";
|
|
|
|
break;
|
|
|
|
case "rm":
|
|
|
|
buf += "\'rm (filename)\' Removes a file from the current directory\n";
|
|
|
|
break;
|
|
|
|
case "mv":
|
|
|
|
buf += "\'mv (filename from) (filename to)\' Moves a file from one directory to another\n";
|
|
|
|
break;
|
|
|
|
case "cp":
|
|
|
|
buf += "\'cp (filename from) (filename to)\' Copies a file from one directory to another\n";
|
|
|
|
break;
|
|
|
|
case "rmdir":
|
|
|
|
buf += "\'rmdir (dirname)\' Removes a directory from the current directory\n";
|
|
|
|
break;
|
|
|
|
case "pwd":
|
|
|
|
buf += "\'pwd\' Prints the current directory out to the console\n";
|
|
|
|
break;
|
|
|
|
case "exec":
|
|
|
|
buf += "\'exec (filename)\' Executes a file in the console, you can \'t use \"exit\" and \"exec\" commands\n";
|
|
|
|
break;
|
|
|
|
case "spam":
|
|
|
|
buf += "\'spam (number) (arg1) (arg2) .......\' Spams the console with a message from arguments\n";
|
|
|
|
break;
|
|
|
|
case "overwrite":
|
|
|
|
buf += "\'overwrite (filename) (arg1) (arg2) .......\' Overwrites a file with from arguments\n";
|
|
|
|
break;
|
|
|
|
case "append":
|
|
|
|
buf += "\'append (filename) (arg1) (arg2) .......\' Appends the arguments to a file\n";
|
|
|
|
break;
|
|
|
|
case "screenshot":
|
|
|
|
buf += "\'screenshot (filename)\' Takes a screenshot of the console and saves it to a file\n";
|
|
|
|
break;
|
|
|
|
case "man":
|
2022-06-12 12:41:52 +02:00
|
|
|
buf += "\'screenshot (command)\' This manual databank\n";
|
|
|
|
break;
|
|
|
|
case "beep":
|
|
|
|
buf += "\'beep\' This command makes a beep\n";
|
|
|
|
break;
|
|
|
|
|
2022-06-12 09:38:38 +02:00
|
|
|
default:
|
|
|
|
buf += "No such command\n"
|
|
|
|
}
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
export {man};
|