https://github.com/tve/commandparser
Super simple commandline processor for Arduino environments
https://github.com/tve/commandparser
arduino arduino-library cli command-line commandline esp32 esp32-arduino
Last synced: about 2 months ago
JSON representation
Super simple commandline processor for Arduino environments
- Host: GitHub
- URL: https://github.com/tve/commandparser
- Owner: tve
- License: mit
- Created: 2019-09-01T19:01:00.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-09-02T00:17:57.000Z (almost 7 years ago)
- Last Synced: 2025-02-14T06:51:15.463Z (over 1 year ago)
- Topics: arduino, arduino-library, cli, command-line, commandline, esp32, esp32-arduino
- Language: C++
- Size: 7.81 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Super simple command-line parser for Arduino
Super simple commandline processor for Arduino environments. Features:
- super small and simple codebase, easy to modify
- provide minimal input editing (backspace)
- register commands, let commands parse args
## How it works
- register command word callbacks using `addCommand()`
- in the callback, use `getArg()` or `getRest()` to get next arg or rest of commandline for parsing
- register default callback using `setDefault()` to print help/error message
- for interactive input processing, use `CommandParser(HardwareSerial *serial)` constructor and call
`loop()` in sketch's own `loop()`
- for batch processing (for example, command recieved via MQTT or HTTP) use `CommandParser()`
constructor and `parseLine()`
## Examples
The best simple example can be found in
https://github.com/tve/esp32-secure-base/blob/master/src/ESPSecureBase.cpp