Skip to content

feature: Move shell features like history/tab completion to the host machine (and other goodies!) #18

@jasta

Description

@jasta

First of all, thank you for this crate, and I'm excited to start using it in a new embedded project of mine! One thing jumped out to me though is that I think we can greatly improve ergonomics (and optimize!) the crate by leveraging the host machine to do more of the heavy lifting job that the shell normally takes over. Specifically, we could ship a special CLI tool that runs on the host machine with the embedded-cli acting as a kind of CLI tool server with the communication pipe being, e.g. the USB serial at /dev/ttyACM0. Advantages of this approach include:

  1. Advanced shell features like history, tab completion, etc can be easily offloaded to the much more powerful host machine (and thus embedded-cli uses less memory)
  2. Embedded commands are scriptable on the host, able to fully support stdin, stdout, stderr, and command exit status transported through e.g. /dev/ttyACM0
  3. Agnostic to USB serial transport (i.e. we could just as easily support transport over Wi-Fi, BLE, LoRa, whatever)
  4. Possibly easier to support async I/O since we could implement the frame reading/writing separate from the embedded-cli handling of those frames.

I've done something like this in the past for Android applications, very similar to the use cases I think you're targetting. The use case there was plug in your phone over USB, then run a custom command on your laptop to interact with your Android application with the core CLI heavy lifting happening on the Android side. See: https://github.com/facebook/stetho/blob/main/scripts/dumpapp for that custom command and you can imagine that the embedded side of this is the server that implements this simple framing protocol.

I'm interested in pursuing support for this with a PR, but I wanted to start the discussion at a higher level first to gauge interest and see if there are gotchas I'm not seeing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions