From 05e497e884aaf10dc4232757c4b9f802fe659875 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Mon, 29 Jan 2024 12:05:17 -0500 Subject: [PATCH 1/3] outdated commands removed --- src/chess_app/chess_engine.md | 5 ++--- src/cookbook/file_transfer.md | 4 ++-- src/cookbook/writing_scripts.md | 12 ++++++++++++ src/kit/boot-fake-node.md | 2 +- src/my_first_app/chapter_1.md | 4 ++-- src/my_first_app/chapter_3.md | 4 ++-- src/quick-start.md | 4 ++-- 7 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/chess_app/chess_engine.md b/src/chess_app/chess_engine.md index 1f5d6a62..ebc68831 100644 --- a/src/chess_app/chess_engine.md +++ b/src/chess_app/chess_engine.md @@ -131,9 +131,8 @@ Below, you'll find the full code for the CLI version of the app. You can build it and install it on a node using `kit`. You can interact with it in the terminal, primitively, like so (assuming your first node is `fake.os` and second is `fake2.os`): ``` -/a our@my_chess:my_chess:template.os -/m {"NewGame": {"white": "fake.os", "black": "fake2.os"}} -/m {"Move": {"game_id": "fake2.os", "move_str": "e2e4"}} +m our@my_chess:my_chess:template.os {"NewGame": {"white": "fake.os", "black": "fake2.os"}} +m our@my_chess:my_chess:template.os {"Move": {"game_id": "fake2.os", "move_str": "e2e4"}} ``` (If you want to make a more ergonomic CLI app, consider parsing `body` as a string...) diff --git a/src/cookbook/file_transfer.md b/src/cookbook/file_transfer.md index 8d2c1ea2..0f51977a 100644 --- a/src/cookbook/file_transfer.md +++ b/src/cookbook/file_transfer.md @@ -278,7 +278,7 @@ kit s -p 8081 and then placing files in the `/vfs/file_transfer:file_transfer/files/` directory of the second (the `--home` dir path is specified as an argument to `boot-fake-node`), and sending a request from the first: ``` -/m fake2.os@file_transfer:file_transfer:template.os "ListFiles" +m fake2.os@file_transfer:file_transfer:template.os "ListFiles" ``` You should see a printed response. @@ -1189,7 +1189,7 @@ There you have it! Try and run it, you can download a file with the command ``` -/m our@file_transfer:file_transfer:template.os {"Download": {"name": "dawg.jpeg", "target": "fake2.os@file_transfer:file_transfer:template.os"}} +m our@file_transfer:file_transfer:template.os {"Download": {"name": "dawg.jpeg", "target": "fake2.os@file_transfer:file_transfer:template.os"}} ``` replacing node name and file name! diff --git a/src/cookbook/writing_scripts.md b/src/cookbook/writing_scripts.md index 27ede4c9..188d9af4 100644 --- a/src/cookbook/writing_scripts.md +++ b/src/cookbook/writing_scripts.md @@ -71,3 +71,15 @@ For instance, the `echo` script is published as part of `terminal:sys`, so you c ```bash echo:terminal:sys Hello World! ``` + +## Aliasing a Script +If you are going to be calling your script very often, you can alias it to something shorter like so: +```bash +alias echo echo:terminal:sys +``` +so now you can call `echo` like `echo Hello World!`. + +To remove the alias, simply run: +```bash +alias echo +``` diff --git a/src/kit/boot-fake-node.md b/src/kit/boot-fake-node.md index 5d6fd2ca..20b70723 100644 --- a/src/kit/boot-fake-node.md +++ b/src/kit/boot-fake-node.md @@ -23,7 +23,7 @@ kit boot-fake-node -h /tmp/kinode-fake-node-2 -p 8081 -f fake2.os # Send a message from fake2.os to fake.os # In the terminal of fake2.os: -/hi fake.os hello! +hi fake.os hello! # You should see "hello!" in the first node's terminal ``` diff --git a/src/my_first_app/chapter_1.md b/src/my_first_app/chapter_1.md index 7043dcbb..76eec469 100644 --- a/src/my_first_app/chapter_1.md +++ b/src/my_first_app/chapter_1.md @@ -282,13 +282,13 @@ kit start-package -p 8081 To send a chat message from the first node, run the following in its terminal: ``` -/m our@my_chat_app:my_chat_app:template.os {"Send": {"target": "fake2.os", "message": "hello world"}} +m our@my_chat_app:my_chat_app:template.os {"Send": {"target": "fake2.os", "message": "hello world"}} ``` and replying, from the other terminal: ``` -/m our@my_chat_app:my_chat_app:template.os {"Send": {"target": "fake.os", "message": "wow, it works!"}} +m our@my_chat_app:my_chat_app:template.os {"Send": {"target": "fake.os", "message": "wow, it works!"}} ``` Messages can also be injected from the outside. diff --git a/src/my_first_app/chapter_3.md b/src/my_first_app/chapter_3.md index d32a9be5..65bed0fc 100644 --- a/src/my_first_app/chapter_3.md +++ b/src/my_first_app/chapter_3.md @@ -191,13 +191,13 @@ At this point, you can use the terminal to test your message types! First, try a hello. Get the address of your process by looking at the "started" printout that came from it in the terminal. As a reminder, these values are set in the `metadata.json` and `manifest.json` package files. ```bash -/m our@:: {"Hello": "hey there"} +m our@:: {"Hello": "hey there"} ``` You should see the message text printed. Next, try a goodbye. This will cause the process to exit. ```bash -/m our@:: "Goodbye" +m our@:: "Goodbye" ``` If you try to send another Hello now, nothing will happen, because the process has exited [(assuming you have set `on_exit: "None"`; with `on_exit: "Restart"` it will immediately start up again)](./chapter_2.md#aside-on_exit). diff --git a/src/quick-start.md b/src/quick-start.md index ed3e1979..cf4c052b 100644 --- a/src/quick-start.md +++ b/src/quick-start.md @@ -39,10 +39,10 @@ kit inject-message my_chat_app:my_chat_app:template.os '{"Send": {"target": "fak # Or, from the terminal running one of the fake nodes: ## First fake node terminal: -/m our@my_chat_app:my_chat_app:template.os {"Send": {"target": "fake2.os", "message": "hello world"}} +m our@my_chat_app:my_chat_app:template.os {"Send": {"target": "fake2.os", "message": "hello world"}} ## Second fake node terminal: -/m our@my_chat_app:my_chat_app:template.os {"Send": {"target": "fake.os", "message": "wow, it works!"}} +m our@my_chat_app:my_chat_app:template.os {"Send": {"target": "fake.os", "message": "wow, it works!"}} ``` ## Next steps From b12e1c7965a9a2009552d39deef68a6ddc179a79 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Mon, 29 Jan 2024 12:38:56 -0500 Subject: [PATCH 2/3] terminal commands documented --- src/SUMMARY.md | 1 + src/terminal.md | 79 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 src/terminal.md diff --git a/src/SUMMARY.md b/src/SUMMARY.md index ef538c7b..c1890694 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -20,6 +20,7 @@ - [HTTP Server & Client](./http_server_and_client.md) - [Files](./files.md) - [Databases](./databases.md) +- [Terminal](./terminal.md) # Process Standard Library diff --git a/src/terminal.md b/src/terminal.md new file mode 100644 index 00000000..897f2e8b --- /dev/null +++ b/src/terminal.md @@ -0,0 +1,79 @@ +# Terminal + +## Basic Usage and Utilities + +All commands in the terminal are calling scripts - a special kind of process. +KinodeOS comes pre-loaded with a number of scripts useful for debugging and everyday use. +These scripts are fully named `