feat: add fswatch, sysinfo, and udp demo scripts plus reorder manual sidebar links

Add three new example scripts demonstrating the fswatch, sysinfo, and udp modules with file watching, system metrics, and UDP echo server/client patterns. Reorder the manual API sidebar navigation to list modules alphabetically, removing deprecated entries like websocket, tls, net, json, regex, jinja, os, signal, subprocess, sqlite, and timer while adding argparse, dataset, fswatch, and html.
This commit is contained in:
2026-01-25 12:09:28 +00:00
parent d487109d7c
commit 819bbd5091
72 changed files with 4332 additions and 643 deletions
+7
View File
@@ -0,0 +1,7 @@
// retoor <retoor@molodetz.nl>
import "sysinfo" for SysInfo
var count = SysInfo.cpuCount
System.print(count is Num) // expect: true
System.print(count > 0) // expect: true
+19
View File
@@ -0,0 +1,19 @@
// retoor <retoor@molodetz.nl>
import "sysinfo" for SysInfo
var cpus = SysInfo.cpuInfo
System.print(cpus is List) // expect: true
System.print(cpus.count > 0) // expect: true
var cpu = cpus[0]
System.print(cpu is Map) // expect: true
System.print(cpu.containsKey("model")) // expect: true
System.print(cpu.containsKey("speed")) // expect: true
System.print(cpu.containsKey("times")) // expect: true
var times = cpu["times"]
System.print(times is Map) // expect: true
System.print(times.containsKey("user")) // expect: true
System.print(times.containsKey("sys")) // expect: true
System.print(times.containsKey("idle")) // expect: true
+7
View File
@@ -0,0 +1,7 @@
// retoor <retoor@molodetz.nl>
import "sysinfo" for SysInfo
var hostname = SysInfo.hostname
System.print(hostname is String) // expect: true
System.print(hostname.count > 0) // expect: true
+9
View File
@@ -0,0 +1,9 @@
// retoor <retoor@molodetz.nl>
import "sysinfo" for SysInfo
var t1 = SysInfo.hrtime
var t2 = SysInfo.hrtime
System.print(t1 is Num) // expect: true
System.print(t2 is Num) // expect: true
System.print(t2 >= t1) // expect: true
+10
View File
@@ -0,0 +1,10 @@
// retoor <retoor@molodetz.nl>
import "sysinfo" for SysInfo
var load = SysInfo.loadAverage
System.print(load is List) // expect: true
System.print(load.count) // expect: 3
System.print(load[0] is Num) // expect: true
System.print(load[1] is Num) // expect: true
System.print(load[2] is Num) // expect: true
+16
View File
@@ -0,0 +1,16 @@
// retoor <retoor@molodetz.nl>
import "sysinfo" for SysInfo
var total = SysInfo.totalMemory
var free = SysInfo.freeMemory
var resident = SysInfo.residentMemory
System.print(total is Num) // expect: true
System.print(free is Num) // expect: true
System.print(resident is Num) // expect: true
System.print(total > 0) // expect: true
System.print(free > 0) // expect: true
System.print(resident > 0) // expect: true
System.print(total >= free) // expect: true
+23
View File
@@ -0,0 +1,23 @@
// retoor <retoor@molodetz.nl>
import "sysinfo" for SysInfo
var interfaces = SysInfo.networkInterfaces
System.print(interfaces is Map) // expect: true
System.print(interfaces.count > 0) // expect: true
for (name in interfaces.keys) {
var addrs = interfaces[name]
System.print(addrs is List) // expect: true
for (addr in addrs) {
System.print(addr is Map) // expect: true
System.print(addr.containsKey("family")) // expect: true
System.print(addr.containsKey("address")) // expect: true
System.print(addr.containsKey("internal")) // expect: true
System.print(addr.containsKey("netmask")) // expect: true
System.print(addr.containsKey("mac")) // expect: true
break
}
break
}
+7
View File
@@ -0,0 +1,7 @@
// retoor <retoor@molodetz.nl>
import "sysinfo" for SysInfo
var uptime = SysInfo.uptime
System.print(uptime is Num) // expect: true
System.print(uptime > 0) // expect: true