Skip to content

Commit fc13209

Browse files
committed
Update the manual
1 parent 0053ec5 commit fc13209

File tree

1 file changed

+146
-83
lines changed

1 file changed

+146
-83
lines changed

Manual.txt

Lines changed: 146 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
\============================================/
55

66
Official repository: https://github.com/beryllium-org/OS
7-
This manual is up to date with Release 0.4.0 @ 09/mar/2024.
7+
This manual is up to date with Release 0.5.0 @ 15/jul/2024.
88
Anything passed that point is not covered by this manual.
99

1010
/------------|
@@ -13,18 +13,18 @@ Anything passed that point is not covered by this manual.
1313

1414
0. Index table : line 10
1515
1. Basic commands : line 27
16-
2. Scripting : line 355
17-
3. Errors : line 377
18-
4. Api functions : line 457
19-
5. jCurses : line 549
20-
6. Led activity : line 602
21-
7. BetterPath : line 613
22-
8. GPIO Usage : line 634
23-
9. Network driver usage : line 660
24-
10. Isolated processes : line 676
25-
11. Packages : line 732
26-
12. Devices and consoles : line 880
27-
13. Contributions : line 932
16+
2. Scripting : line 409
17+
3. Errors : line 431
18+
4. Api functions : line 511
19+
5. jCurses : line 617
20+
6. Led activity : line 670
21+
7. Virtual Paths : line 681
22+
8. GPIO Usage : line 702
23+
9. Network driver usage : line 730
24+
10. Isolated processes : line 746
25+
11. Packages : line 802
26+
12. Devices and consoles : line 949
27+
13. Contributions : line 995
2828

2929
/---------------|
3030
----<| Basic commands |
@@ -45,6 +45,11 @@ alias [COMMAND=data]
4545
Runs data, whenever command is typed
4646

4747

48+
bcast [DATA]
49+
50+
Broadcast a message to all terminals
51+
52+
4853
bell
4954

5055
Ring the bell on the current terminal
@@ -58,14 +63,19 @@ Catenates the contents of file [file]
5863
cd [DIR]
5964

6065
Changes to specified directory
61-
Please refer to the betterpath section, on more info on how does the board filesystem appear.
66+
Please refer to the virtual paths section, on more info on how does the board filesystem appear.
6267

6368

6469
clear
6570

6671
Clear the current terminal, clearing scrollback too.
6772

6873

74+
clear_line
75+
76+
Clear the current terminal line.
77+
78+
6979
cp [SOURCE] [DESTINATION]
7080

7181
Copies source to destination.
@@ -99,6 +109,11 @@ df [-h]
99109
Report all attached file system's space usage.
100110

101111

112+
dir [??].. ??
113+
114+
A paradox of unknown origin. Unknown effects.
115+
116+
102117
dmesg
103118

104119
Prints out the current dmesg log.
@@ -128,6 +143,16 @@ Attempts to disconnect the shell.
128143
If the shell cannot be disconnected, ask the user to disconnect instead.
129144

130145

146+
false
147+
148+
Returns a false exit code.
149+
150+
151+
flush
152+
153+
Flushes terminal forcibly.
154+
155+
131156
fpexec [file]
132157

133158
Runs a python file in a new process.
@@ -154,6 +179,11 @@ help [COMMAND]
154179
Displays all currently discovered commands.
155180

156181

182+
hold
183+
184+
Hold terminal output.
185+
186+
157187
history [save/load/clear]
158188

159189
Displays the command history.
@@ -214,6 +244,11 @@ modprobe [MODULE as MODULE_TYPE]
214244
Load a kernel MODULE with it's type specified by MODULE_TYPE.
215245

216246

247+
mv [SRC] [DST]
248+
249+
Moves files or folders from source to destination.
250+
251+
217252
pinout
218253

219254
Display current board pinout.
@@ -289,6 +324,11 @@ Run all the .py files in a folder by alphabetic order.
289324
Used by init.
290325

291326

327+
runtasks
328+
329+
Enters task execution mode, running all background tasks.
330+
331+
292332
sleep [TIME]
293333

294334
Sleep TIME, in seconds.
@@ -299,6 +339,11 @@ sync
299339
Sync all currently attached filesystems.
300340

301341

342+
sysinfo
343+
344+
Displays system info.
345+
346+
302347
terminal [get/list/activate]...
303348

304349
A command to retrieve / set the current console.
@@ -332,10 +377,12 @@ Removes ALIAS.
332377

333378
uname [-a]
334379

335-
Print system information
380+
Print system information.
336381

337382

338-
Loads an .lja file and executes it's commands
383+
unhold
384+
385+
Releases a terminal, allowing data output.
339386

340387

341388
unset [Variable]
@@ -467,26 +514,42 @@ CODE:
467514

468515
Beryllium OS api functions.
469516
Available from:
470-
be.api.[function](parameters)
517+
be.api.[function](parameters)
518+
519+
tasks
520+
run() -> None
521+
Run background tasks if needed.
522+
523+
add(name: str, priority: int 0-100, check_func: function, run_func: function) -> int
524+
Add a task, returns a pid.
471525

472-
remove_ansi(text)
473-
Removes all ansi escape from a string of text and returns
474-
the cleared string.
526+
rm(pid: int)
527+
Deletes a task.
475528

476-
getvar(var)
529+
security
530+
auth <- class
531+
__init__(value: any)
532+
key(value: any) -> bool
533+
id <- property
534+
A class that can be used for securely store a private variable.
535+
It will never permit access to that variable.
536+
You can only check if a value matches.
537+
Causes a blocking delay when authentication fails.
538+
539+
getvar(var)
477540
Variable getter.
478541
Returns variable var, from be.based.user_vars or be.based.system_vars.
479542
The var name has to be an str.
480543
In case it doesn't exist, returns None.
481544

482-
setvar(var, data=None, system=False)
545+
setvar(var, data=None, system=False)
483546
Variable setter / deleter.
484547
Sets variable var, in be.based.user_vars.
485548
The var name has to be an str.
486549
When the data is None, deletes the variable.
487550
The system option, when True, uses be.based.system_vars instead.
488551

489-
xarg(rinpt=None, fn=False)
552+
xarg(rinpt=None, fn=False)
490553
Argument parser.
491554
When no input stream specified, rely on be.based.user_vars["argj"].
492555
Returns a dict with the following stuff:
@@ -498,59 +561,57 @@ Available from:
498561
Example: "ls -a /bin", {"a": "/bin"} is gonna be in "o"
499562
"n" if False is passed to fn, contains the filename
500563

501-
fopen(object)
502-
Meant to be used with "with".
503-
Opens files with the path automatically parsed by betterpath.
504-
Also remounts the filesystem when in write or append mode automatically.
505-
Example:
506-
with be.api.fopen("/bin/nano.py", "w")
507-
508-
isdir(dirr, rdir=None)
509-
Checks if given item is file (returns 0) or directory (returns 1).
510-
Returns 2 if it doesn't exist.
511-
512-
rdir specifies reference directory.
513-
When None, automatically use . as reference.
514-
515-
betterpath(back=None)
516-
Automatically rewrite paths to match virtual filesystem.
517-
Assuming root (pv[0]["root"]) is set to "/Beryllium"
518-
/Beryllium/bin/nano.py -> /bin/nano.py
519-
/boot_out.txt -> &/boot_out.txt
520-
/ -> &
521-
~ automatically parsed
522-
523-
When None, return current directory.
524-
525-
basepath(path=".")
526-
Return the absolute and true path of a given location.
527-
Returns "" if the path doesn't exist.
528-
529-
listdir(path=".")
530-
Virtual directory listing. Returns permissions, size, filetype, modification time
531-
and much more.
532-
Supports Beryllium OS virtual drives and enumerates devices.
533-
Returns a nested list.
534-
535-
adv_input(whatever, _type)
536-
Universal variable request
537-
Returns the variable's value in the specified type
538-
Parameters:
539-
whatever : The name of the variable
540-
_type : The type in which it should be returned
541-
Returns:
542-
The result of the variable in the type
543-
specified if found
544-
Otherwise, it returns the input.
545-
546-
subscript(filen)
547-
Runs as script in the current scope.
548-
Does not report back failure / success.
549-
Use process variables to check.
550-
551-
console_connected()
552-
Fast function to check if any console is connected.
553-
Returns the boolean state.
564+
fs
565+
resolve(back: str = None) -> str
566+
Path translation from Beryllium OS virtual paths to real path.
567+
For example: &/settings.toml -> /settings.toml
568+
/bin/ls.py -> /Beryllium/bin/ls.py
569+
570+
base(path=".") -> str
571+
Given a path, finds what is the physical path.
572+
../../../../../ -> /
573+
/bin/../bin -> bin
574+
575+
isdir(dirr: str, rdir: str = None) -> int
576+
Tests if input is a folder, file or doesn't exist.
577+
Returns:
578+
- 0 for files
579+
- 1 for folders
580+
- 2 if it doesn't exist
581+
582+
open <- class
583+
Equivelant to open(), but works with all virtual paths.
584+
585+
listdir(path=".") -> list
586+
An advanced directory lister, that supports all virtual paths.
587+
Returns a list that contains lists.
588+
Each sublist is structured as follows:
589+
0: name
590+
1: type, can be "f", "d", "c" for file, folder, device respectively.
591+
2: permissions, a 3 item list following unix user/group/others format.
592+
3: size in bytes
593+
4: modification time in struct_time
594+
5: owner
595+
6: group
596+
597+
code_load(filename: str) -> code
598+
Loads a python code file and returns a code object.
599+
May raise an OSError if the file does not exist, or other errors,
600+
during code compilation.
601+
602+
adv_input(whatever: any, _type=str):
603+
Universal variable requester.
604+
Fetches variables from all contexts and returns it _type casted.
605+
606+
subscript(filen: str) -> None
607+
A helper function for calling for scripts to run under other scripts,
608+
under the same scope, pid and variable container storage.
609+
610+
console_connected() -> bool
611+
Tests if any console is connected, and automatically loads it.
612+
613+
bcast(msg: str) -> None
614+
Broadcasts a message to all consoles.
554615

555616

556617
/--------|
@@ -617,16 +678,15 @@ Neopixels stay green when idle, glow more when special characters are being inpu
617678
green normally, red when an error occurs, yellow on activity and blue when waiting.
618679

619680

620-
/-----------|
621-
----<| BetterPath |
622-
\-----------|
681+
/--------------|
682+
----<| Virtual paths |
683+
\--------------|
623684

624685
The beryllium kernel is in the board's root, while the os root is under by default under /Beryllium.
625686
The root path is set by the kernel in pv[0]["root"].
626687
Root cannot be "/".
627-
Betterpath is a function that is integrated into the kernel to make the
628-
os appear and function as if /Beryllium is the real root.
629-
It works by standing as a middleman between all os path requests.
688+
For simulating the root being under "/" virtual paths are used with kernel integrations.
689+
The be.api.fs.resolve function stands as a middleman between userspace all os path requests.
630690
However it doesn't prohibit the access to the board's real root.
631691
It work by mapping:
632692

@@ -636,6 +696,7 @@ It work by mapping:
636696

637697
And treating all subsequent paths by that rule.
638698
It additionally maps "~" to the user's home directory, and "-" to the previous directory.
699+
All kernel functions use resolved virtual paths automatically.
639700

640701

641702
/-----------|
@@ -661,7 +722,9 @@ Temporarily, only analog reads are supported. This is achieved by:
661722
```
662723
a = adc#GP25
663724
```
664-
Analog writes through the use of PWM will be added soon.
725+
726+
For using I2C, UART and ADC there are program provided from the adctools,
727+
i2ctools and uartutils packages.
665728

666729

667730
/---------------------|

0 commit comments

Comments
 (0)