tos library / API / tos.term
tos.term
A singleton instance of the internal Terminal class. It provides cross-platform helpers for interacting with the host terminal.
Methods
tos.term.cls()
Clears the terminal screen. On Windows the underlying call is cls; on every other platform reported by platform.system() it falls back to clear.
import tos
tos.term.cls()
print("Fresh screen!")
Warning: cls() spawns a subprocess via os.system. Do not pass user input to a future overload — extending the class carelessly could open a shell-injection hole.
Platform matrix
platform.system() | Command run |
|---|---|
Windows | cls |
Linux | clear |
Darwin (macOS) | clear |
| Anything else | clear |