9 releases (4 breaking)
Uses new Rust 2024
| 0.7.5 | Jul 22, 2026 |
|---|---|
| 0.7.4 | May 10, 2026 |
| 0.7.0 | Apr 13, 2026 |
| 0.5.1 | Apr 13, 2026 |
| 0.1.0 | Apr 13, 2026 |
#91 in Hardware support
235KB
4.5K
SLoC
libiot
Unified CLI dispatcher for the libiot ecosystem.
libiot discovers all installed libiot-* CLI binaries on $PATH
and exposes them as subcommands — similar to how git dispatches to
git-* programs. It also provides alias management, per-command
environment variable injection, and cargo install/uninstall
wrappers.
Quick start
# Install the dispatcher
cargo install libiot
# Install a device CLI
libiot install rollease-automate-pulse-pro-hub
# Use it via the full name
libiot rollease-automate-pulse-pro-hub info
# Or create a short alias
libiot set alias rollease-automate-pulse-pro-hub shades
libiot shades info
# Set a persistent env var so you don't have to pass --hub every time
libiot set env-var shades PULSE_PRO_HUB 192.168.1.2
libiot shades info # LIBIOT_PULSE_PRO_HUB is injected automatically
Two operating modes
Built-in commands — manage aliases, env vars, and installations:
| Command | Description |
|---|---|
libiot set alias CMD ALIAS [-f] |
Create an alias for a CLI command |
libiot unset alias ALIAS |
Remove an alias |
libiot get alias ALIAS |
Show what an alias points to |
libiot set env-var CMD VAR VALUE |
Set a per-command env var |
libiot unset env-var CMD VAR |
Remove a per-command env var |
libiot get env-var CMD VAR |
Show a per-command env var value |
libiot list |
List all CLIs and aliases |
libiot list aliases |
List all aliases |
libiot list env-vars [CMD] |
List env vars, optionally for one cmd |
libiot install NAME [--alias ALIAS] |
Install a libiot CLI via cargo |
libiot uninstall NAME |
Uninstall a libiot CLI via cargo |
libiot config-path |
Print the settings file path |
libiot completions SHELL |
Generate shell completions |
Delegation mode — anything else is exec'd to the matching
libiot-* binary:
libiot rollease-automate-pulse-pro-hub info
# equivalent to: libiot-rollease-automate-pulse-pro-hub info
Top-level flags (--format, --quiet) are only available for built-in
commands. In delegation mode, all arguments are passed through verbatim.
Testing unpublished CLIs (--staged-impl / -s)
When developing a new libiot-<vendor>-<device>-cli crate, the
dispatcher can run it directly from a local crate path instead of
looking it up on $PATH. This lets you exercise the in-progress crate
through the dispatcher (with all of your aliases and env vars applied)
before publishing or cargo installing it.
# Long form
libiot --staged-impl /path/to/libiot-foo-cli foo --help
# Short form
libiot -s /path/to/libiot-foo-cli foo --help
# Both `--staged-impl=PATH` and `-sPATH` (attached) work too.
Under the hood this replaces the PATH lookup with
cargo run --quiet --manifest-path <PATH>/Cargo.toml --bin libiot-<short>
(the bin name is derived from the crate directory's basename, with any
trailing -cli stripped). Alias resolution and LIBIOT_* env-var
injection still happen against the user-supplied command name, so the
staged binary sees exactly the env it would see after cargo install.
The flag is only valid in delegation mode — pairing it with a built-in subcommand is a hard error. A warning is printed if the staged crate's short name does not match the alias-resolved command name.
Environment variables
Env vars set via libiot set env-var are stored without the LIBIOT_
prefix. The prefix is added automatically at execution time. For
example:
libiot set env-var shades PULSE_PRO_HUB 192.168.1.2
# When running `libiot shades ...`, the child process sees:
# LIBIOT_PULSE_PRO_HUB=192.168.1.2
When using an alias, env vars are resolved in order:
- Underlying command's env vars (base)
- Alias-specific env vars (override)
Configuration
Settings are stored in ~/.config/libiot/settings.json (override with
LIBIOT_CONFIG_DIR). The file is created on first write with 0600
permissions.
Output formats
--format human(default) — aligned, human-readable text--format json— structured JSON for scripting--quiet/-q— suppress non-error output
Dependencies
~2.8–8MB
~171K SLoC