Skip to content

Commit

Permalink
Add README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tgtakaoka committed Jun 1, 2024
1 parent 6639a42 commit e75bb64
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 127 deletions.
32 changes: 15 additions & 17 deletions README.adoc → README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
image:https://img.shields.io/github/v/release/tgtakaoka/libcli.svg?maxAge=3600[https://github.com/tgtakaoka/libcli/releases]
image:https://img.shields.io/badge/License-Apache%202.0-blue.svg[https://github.com/tgtakaoka/libcli/blob/main/LICENSE.md]
image:https://github.com/tgtakaoka/libcli/actions/workflows/ccpp.yml/badge.svg[link="https://github.com/tgtakaoka/libcli/actions/workflows/ccpp.yml"]
image:https://github.com/tgtakaoka/libcli/actions/workflows/arduino-ci.yml/badge.svg[link="https://github.com/tgtakaoka/libcli/actions/workflows/arduino-ci.yml"]
image:https://github.com/tgtakaoka/libcli/actions/workflows/platformio-ci.yml/badge.svg[https://github.com/tgtakaoka/libcli/actions/workflows/platformio-ci.yml]
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/tgtakaoka/library/libcli.svg)](https://registry.platformio.org/libraries/tgtakaoka/libcli)
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/tgtakaoka/libcli/blob/main/LICENSE.md)
[![Continuous Integration](https://github.com/tgtakaoka/libcli/actions/workflows/ccpp.yml/badge.svg)](https://github.com/tgtakaoka/libcli/actions/workflows/ccpp.yml)
[![Continuous Integration](https://github.com/tgtakaoka/libcli/actions/workflows/arduino-ci.yml/badge.svg)](https://github.com/tgtakaoka/libcli/actions/workflows/arduino-ci.yml)
[![COntinuous Integration](https://github.com/tgtakaoka/libcli/actions/workflows/platformio-ci.yml/badge.svg)](https://github.com/tgtakaoka/libcli/actions/workflows/platformio-ci.yml)

= libcli for Arduino IDE =
### libcli for Arduino IDE ###

Support library to help implementing asynchronous command line
interface.
Expand Down Expand Up @@ -37,12 +37,11 @@ be called with input `_value_`, the `_context_` passed in the
*_request_*, and a input `_state_`.

You can find concrete examples at
https://github.com/tgtakaoka/libasm/blob/devel/src/arduino_example.h[libasm]
[libasm](https://github.com/tgtakaoka/libasm/blob/main/src/arduino_example.h)
and
https://github.com/tgtakaoka/RetroCyborg/blob/main/BionicMC6801/debugger/commands.cpp[RetroCyborg].
[retro-bionic](https://github.com/tgtakaoka/retro-bionic/blob/main/debugger/debugger.cpp)

[source,C++]
----
~~~c++
libcli::Cli cli;
using State = libcli::State;

Expand All @@ -64,12 +63,10 @@ void loop() {
cli.loop();
/* do other stuff */
}
----
~~~
The version 1.3 API has the following functions.

[source,C++]
----
~~~c++
/** void (*LetterCallback)(char letter, uintptr_t context); */
using LetterCallback = libcli::LetterCallback;
void readLetter(LetterCallback callback, uintptr_t context);
Expand All @@ -96,7 +93,8 @@ void printlnStr_P(const /*PROGMEM*/ char *text_P, int8_t width = 0);
void printlnHex(uint32_t number, int8_t width = 0);
void printlnDec(uint32_t number, int8_t width = 0);
void backspace(int8_t n = 1);
----
~~~

NOTE: More information about this library can be found at
https://github.com/tgtakaoka/libcli[GitHub]
[!NOTE]
More information about this library can be found at
[GitHub](https://github.com/tgtakaoka/libcli)
29 changes: 16 additions & 13 deletions examples/cli/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,27 @@ help:
@echo '"make clean" remove unnecessary files'
@echo '"make pio" run PlatformIO CI'

PIO_ENVS=$(shell grep -Po '^\[env:\K[^]]+' platformio.ini)
LIB_ENVS=$(PIO_ENVS:%=.pio/libdeps/%)
PIO_BOARDS=$(shell grep -Po '^board *= *\K[\w]+' platformio.ini)
ifdef INSIDE_EMACS
ifeq ($(filter $(PIO_FLAGS),"--no-ansi"),)
PIO_FLAGS += --no-ansi
endif
endif

install_local_lib:
for lib in $(LIB_ENVS); do \
test -h $${lib}/libcli && continue; \
mkdir -p $${lib} && rm -rf $${lib}/libcli; \
ln -s $${PWD}/../.. $${lib}/libcli; \
done
ENVS=$(shell grep -Po '^\[env:\K[^]]+' platformio.ini)
BOARDS=$(shell grep -Po '^board *= *\K[\w]+' platformio.ini)

pio: install_local_lib
pio --no-ansi run $(PIO_ENVS:%=-e %)
define pio-ci # board
pio $(PIO_FLAGS) ci -l ../.. $(PIO_CI_FLAGS) -b $(1) cli.ino

endef

pio:
$(foreach board,$(BOARDS),$(call pio-ci,$(board)))

pio-boards: platformio.ini
@echo $(PIO_BOARDS)
@echo $(BOARDS)
pio-envs: platformio.ini
@echo $(PIO_ENVS)
@echo $(ENVS)

clean:
rm -rf $$(find . -type d -a -name .pio)
Expand Down
Loading

0 comments on commit e75bb64

Please sign in to comment.