About
Cross-platform flexible autocomplete library for your CLI applications
Features
- Cross-platform:
MacOS
, Linux
, Windows
- Write your own autocomplete rules
- Setup your own highlight colors
single header
version of the library
static
and dynamic
versions of the library
Config Example
- After
git
may follow: config
, init
, clone
- After
config
may follow: --global
, user.name
, user.email
- After
--global
may follow: user.name
, user.email
- After
user.name
may follow optional value: "[name]"
...
git
config
--global
user.name
"[name]"
user.email
"[email]"
user.name
"[name]"
user.email
"[email]"
init
[repository_name]
clone
[url]
Simple Example
More complex example with: color settings
, handling optional values
and line title configuration
you will find here
#include <stdio.h>
#include "../include/autocomplete.h"
int main() {
Tree* rules = tree_create("../example.config");
fprintf(
stderr,
"Attention! Please run the executable file only\n"
" through the command line!\n\n"
"- To switch the prompts press UP or DOWN arrow.\n"
"- To move cursor press LEFT or RIGHT arrow.\n"
"- To edit input press DELETE or BACKSPACE key.\n"
"- To apply current prompt press TAB key.\n\n"
);
while (1) {
char* str = input(rules);
printf("\n%s\n", str);
if (strcmp(str, "") == 0) {
free(str);
break;
}
free(str);
}
tree_free(rules);
return 0;
}
How to start
git clone https://github.com/DieTime/CLI-AutoComplete.git
cd CLI-AutoComplete/
cmake -DCMAKE_BUILD_TYPE=Release -S . -B ./cmake-build
cmake --build ./cmake-build --config Release
----------------------- RUN EXAMPLE ---------------------
cd builds/examples/unix/Release
./custom_example
cd builds/examples/mingw/Release
custom_example.exe
cd builds/examples/msvc/Release
custom_example.exe
Linking a shared library [Releases]
Unix
gcc -o <executable> <paths/of/source/files> -L<path/to/shared/lib/folder> -I<path/to/include/folder> -lcliac -Wl,-rpath,<path/to/shared/lib/folder>
Windows MSVC from VS Command Prompt
cl /EHsc <paths/of/source/files> /Fe<executable>.exe /I<path/to/include/folder> /link <path/to/shared/lib/file(.lib)>
Windows MinGW
gcc -o <executable>.exe <paths/of/source/files> -L<path/to/shared/lib/folder> -I<path/to/include/folder> -lcliac
Linking a static library [Releases]
Unix
gcc -o <executable> <paths/of/source/files> -L<path/to/static/lib/folder> -I<path/to/include/folder> -lcliac
Windows MSVC from VS Command Prompt
cl /EHsc <paths/of/source/files> /Fe<executable>.exe /I<path/to/include/folder> /link <path/to/static/lib/file(.lib)>
Windows MinGW
gcc -o <executable>.exe <paths/of/source/files> -L<path/to/static/lib/folder> -I<path/to/include/folder> -lcliac
About changes
A detailed description of the changes can be found in CHANGELOG.md