Update README.md

This commit is contained in:
2026-11-17 22:56:31 +01:00
parent 031f8f7726
commit 7310ae9671
+32 -11
View File
@@ -25,19 +25,40 @@ It doesnt implement a website friendly interface on its own. Thats one of the de
[ref2]: https://pnpm.io/installation
```bash
git clone https://git.gornodox.dev/ChaosMaker/termos.git
cd termos
npm install
pnpm add "https://git.gornodox.dev/ChaosMaker/termos/releases/download/0.1.0/termos-0.1.0.tgz"
```
## Running the project
## Minimal usecase
```bash
npm run dev
```typescript
import { Termos } from "termos";
const shell = await Termos.getShell({
filesystem: {
// an example json representation of the filesystem
json: `{"dev": [{"id":0,"tree": {"atime": 1788458541,"children": [{"atime": 1794947961,"children": [],"content": [87,101,108,99,111,109,101,32,116,111,32,84,101,114,109,111,115,33,32,240,144,148,140,213,158,46,32,46,213,158,240,144,166,175,10],"ctime": 1794948078,"group": 0,"inode": 1,"link_count": 1,"mode": 420,"mtime": 1794948078,"name": "hello_world.txt","owner": 0,"parent": 0,"size": 35,"type": "regular"}],"content": null,"ctime": 1794947961,"group": 0,"inode": 0,"link_count": 2,"mode": 493,"mtime": 1794947961,"name": "root","owner": 0,"parent": 0,"size": 29,"type": "directory"}}]}`,
},
users: [{ username: "root", groups: ["root"], home: "/" }],
groups: ["root"],
general: { user: "root" },
});
// Subscribtion needed to recive command results and print out error messages
shell.on("result", payload => {
if (payload.result.type === "error") {
console.log(payload.result.error.message + "\n");
}
process.stdout.write("\n" + "Hello~\n> ");
});
// Subscribtion needed to recieve stdout buffer contents from shell
shell.on("stdout", payload => {
const decoded = new TextDecoder().decode(payload.data);
process.stdout.write(decoded);
});
// Takes in a string and executes it as a command
shell.sendInput("async");
```
## Running the test suite
```bash
npm run test
```
For more information, reference the [wiki]()