Lua API Overview
ptool exposes a broad set of helpers through ptool and p.
Core APIs
- Core Lua API: Script lifecycle, process execution, config, and terminal helpers.
Modules
- Args API: Command-line argument schema parsing for Lua scripts.
- SemVer API: Parse, compare, and bump semantic versions.
- Hash API: Compute SHA-256, SHA-1, and MD5 digests.
- Network API: Parse URLs, IP addresses, and host-port pairs.
- OS API: Read runtime environment variables and inspect host process details.
- Platform API: Detect the current OS, architecture, and target triple.
- ANSI API: Build styled terminal output with ANSI escape sequences.
- Log API: Write timestamped terminal logs with level-based output.
- HTTP API: Send HTTP requests and consume response bodies.
- JSON API: Parse JSON text and stringify Lua values as JSON.
- YAML API: Parse YAML text, read nested values, and stringify Lua values as YAML.
- Database API: Open database connections and run SQL queries.
- SSH API: Connect to remote hosts, run commands, and transfer files.
- Path API: Manipulate paths lexically without touching the filesystem.
- TOML API: Parse, stringify, read, update, and remove TOML values.
- Regex API: Compile regexes and search, capture, replace, or split text.
- String API: Trim, split, join, replace, and format strings.
- Table API: Map, filter, and concatenate dense list tables.
- Filesystem API: Read, write, create, and glob filesystem paths.
- Shell API: Split shell-like command lines into argument arrays.
- Template API: Render text templates from Lua data.
Use this page as the entrypoint, then jump to the module page you need for the full function reference.