Skip to content
A simple heapless command line interface parser for embedded devices
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.cargo
ci
examples
src
.gdbinit
.gitignore
.travis.yml
Cargo.toml
README.md
gen-examples.sh
memory.x

README.md

light-cli

A lightweight and heapless command line interface / command passing tool. Probably more useful for machine to machine communication.

Documentation

[Example]

The following definition allows for the commands:

  • HELLO Name=<Name>: Set the name to <Name>
  • EHLO: Return the name
lightcli!(cl_in, cl_out, cmd, key, val, [
  "HELLO" => [
    "Name" => name = String::from(val)
  ] => { writeln!(cl_out, "Name set").unwrap(); };
  "EHLO" => [
  ] => { writeln!(cl_out, "EHLO Name={}", name.as_str()).unwrap(); }
]);

A typical serial communication could look like:

>> EHLO
<< EHLO Name=
>> HELLO Name=Johnson
<< Name set
>> EHLO
<< EHLO Name=Johnson

It is recommended to use this in conjunction with the program rlwrap.

Complete Example

What works

  • Read key value style commands in the form: COMMAND KEY=VALUE
  • UTF-8 encoding.
  • Specify the heapless string length.
  • Partial command evaluation as data is received through the serial connection.

TODO

  • Writing to output
  • Improve UTF-8 error detection / code.
  • Any form of autocompletion / backspaces etc.

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

You can’t perform that action at this time.