light-cli logo

light-cli

Free

a lightweight heapless cli interface [![crates.io](https://img.shields.io/crates/v/light_cli.svg)](https://crates.io/crates/light_cli)

FreeFree tier
Inputs: textOutputs: text
Type
Open Source

About light-cli

light-cli is a simple, heapless command line interface parser for embedded devices, written in Rust. It is designed for lightweight machine-to-machine communication over serial connections, supporting key-value style commands (e.g., COMMAND KEY=VALUE) with UTF-8 encoding. The parser uses Rust macros (lightcli!) for defining commands and handles partial command evaluation as data is received serially, making it suitable for resource-constrained environments. It is recommended for use with rlwrap. The project is dual-licensed under MIT and Apache 2.0.

Key Features

Heapless (no dynamic memory allocation)
Lightweight and minimal footprint
Key-value style commands (COMMAND KEY=VALUE)
UTF-8 encoding for commands and values
Partial command evaluation as data is received via serial
Uses Rust macros (lightcli!) for command definition
Allows specifying heapless string length
Recommended for use with rlwrap for better serial interaction

Pros & Cons

Pros
  • No heap allocations, suitable for resource-constrained devices
  • Lightweight and efficient for embedded use
  • Supports partial command evaluation for real-time parsing
  • Full UTF-8 support for commands and values
  • Dual-licensed under MIT and Apache 2.0, permissive
Cons
  • Limited to key-value style commands only
  • No built-in autocompletion or backspace handling
  • UTF-8 error detection is noted as a TODO
  • Output writing to serial is still a TODO
  • Primarily designed for machine-to-machine, not user-friendly interactive CLI

Best For

Embedded device command line interfaceMachine-to-machine communication over serialConfiguring embedded systems via serial commands