Skip to content

Repository files navigation

Reactions is object-oriented library for creating command-based console application. It is adopted version of framework Takes.

Quick start

Create this app.cpp file:

#include"Reactions/exit/ExNever.h"
#include"Reactions/fork/FkElse.h"
#include"Reactions/fork/FkWithName.h"
#include"Reactions/front/Console.h"
#include"Reactions/reaction/RcFork.h"
#include"Reactions/reaction/RcText.h"// NOLINTNEXTLINE(bugprone-exception-escape)automain() -> int {
make<Console>(
make<RcFork>(
make<FkWithName>("welcome", make<RcText>("Hello, World!\n")),
make<FkElse>(make<RcText>("Unknown command!\n"))
),
">"
)
->start(make<ExNever>());
}

Add this library in your CMake project. Part of CMakeLists.txt:

add_executable(appapp.cpp)
target_link_libraries(appPRIVATEReactions::Reactions)

Build it like this:

$ cmake -B build
$ cmake --build build --target app

And run executable like this:

$ ./build/app

Build and Run with CMake

Note: Today library support only CMake build system.

Your CMakeLists.txt should look like:

cmake_minimum_required(VERSION3.25)
project(App CXX)
set(CMAKE_CXX_STANDARD 20)
set(TARGET ${PROJECT_NAME}) # your application target nameinclude(FetchContent)
FetchContent_Declare(
Reactions
GIT_REPOSITORY https://github.com/Chamber6821/Reactions.git
GIT_TAG 0.0.1
)
add_executable(${TARGET}app.cpp)
FetchContent_MakeAvailable(Reactions)
target_link_libraries(${TARGET}PRIVATEReactions::Reactions)

With this configuration you can run it from command line:

$ cmake -B build
$ cmake --build build --target App
$ ./build/App

About

Object-oriented library for creating command-based console application

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages