OC-PsychOS/docs/userguide.md

68 lines
1.4 KiB
Markdown

# PsychOS user guide
## Useful key combinations:
`ctrl-shift-c` inside PsychOS will cancel text input or stop certain programs.
`ctrl-shift-r` will soft-reboot the machine, preserving the content of `/tmp`.
## The lush shell
lush is the default shell of PsychOS. It allows executing functions in memory, programs on disk and Lua typed directly into lush, in order of preference.
The default prompt is `[<user>@<hostname> <current directory>]$`
Some example usage:
### running a function
```
[user@host /boot]$ =ps
function: 0x12ed5c0
```
This is checking if ps is indeed a function.
```
[user@host /boot]$ ps
PID User Name
3 superu logflushd
4 superu ncd
5 superu tty[randomstringabcd]: 8f01b7c7,89734f0
6 superu kbd: 1f46ed58
7 superu kbd-clibboard: 1f46ed58
8 superu login manager: randomstringabcd
```
This runs the ps function. You can also have arguments following the function name, separated by spaces.
### running a program on disk
You have the following program stored as count.lua, in the current directory:
```
for i = 1, 5 do
print(i)
end
```
To run it, all you need to do is:
```
[user@host /boot]$ count
```
You should get the expected output:
```
1
2
3
4
5
```
### running Lua code
Running Lua from lush is also simple, in that you just type it in.
```
[user@host /boot]$ for i = 1, 5 do print(i) end
```
You should get the same output as the last example.