Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/riboseinc/libnereon
a multi-configuration parser library
https://github.com/riboseinc/libnereon
configuration hcl library parser parser-library
Last synced: 15 days ago
JSON representation
a multi-configuration parser library
- Host: GitHub
- URL: https://github.com/riboseinc/libnereon
- Owner: riboseinc
- Created: 2018-04-25T08:59:40.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-01-17T07:28:45.000Z (almost 3 years ago)
- Last Synced: 2024-03-24T20:36:44.324Z (8 months ago)
- Topics: configuration, hcl, library, parser, parser-library
- Language: C
- Homepage:
- Size: 183 KB
- Stars: 4
- Watchers: 9
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.adoc
Awesome Lists containing this project
README
= LIBNEREON
:doctype: bookimage:https://github.com/riboseinc/libnereon/actions/workflows/nix.yml/badge.svg[Nix Build Status, link=https://github.com/riboseinc/libnereon/actions/workflows/nix.yml]
image:https://github.com/riboseinc/libnereon/actions/workflows/windows-msys.yml/badge.svg[Windows Build Status, link=https://github.com/riboseinc/libnereon/actions/workflows/windows-msys.yml]
image:https://github.com/riboseinc/libnereon/actions/workflows/macos.yml/badge.svg[MacOS Build Status, link=https://github.com/riboseinc/libnereon/actions/workflows/macos.yml]
image:https://github.com/riboseinc/libnereon/actions/workflows/ubuntu.yml/badge.svg[Ubuntu Build Status, link=https://github.com/riboseinc/libnereon/actions/workflows/ubuntu.yml]
image:https://img.shields.io/cirrus/github/riboseinc/libnereon?label=freebsd&logo=cirrus%20ci["FreeBSD Build Status", link="https://cirrus-ci.com/github/riboseinc/libnereon"]*Table of Contents* _generated with http://doctoc.herokuapp.com/[DocToc]_
* <>
* <>
* <>
* <>== Introduction
`libnereon` is a multi-configuration parser library implemented in C. This library parses the following configurations by https://github.com/vstakhov/libucl[HCL].
* The command-line arguments.
* The environment variables.
* The configuration files.== How To Build
To build `libnereon` on Ubuntu:
----
sudo apt install automake libtool cmake
mkdir build
cd build
cmake ..
make
----To build `libnereon` on MacOS:
----
brew install automake libtool cmake pkg-config
mkdir build
cd build
cmake ..
make
----To build `libnereon` on Windows using MSYS2 environment:
----
pacman -S --needed autoconf automake cmake gcc libtool make
mkdir build
cd build
cmake .. -G "Unix Makefiles"
make
----== NOS and NOC syntax
`libnereon` uses NOS and NOC configurations based on HCL syntax.
=== NOS configuration
`NOS` is the `NereOn configuration Schema` syntax that allows describing what configuration parameters are allowed.
It has the following HCL syntax:----
config_option {
type =cmdline "switch" {
short =
long =
}cmdline "description" {
short =
long =
}env =
config =default =
}
----* `type` has the following configuration types:
** `basic types` : `int`, `bool`, `string`, `float`, `array`
** `config` : the configuration option with this type describes how to specify configuration file from command line and environment variable.
** `helper` : the configuration option with this type describes command line options how to show help message.
* `cmdline switch` describes short and long switch options on command line.
* `cmdline description` describes short and long descriptions on command line.
* `env` describes environment variable to specify the option.
* `config` describes NOC keyword to specify the option.
* `default` specifies default value of the option.=== NOC configuration
`NOC` is the `NereOn Configuration` syntax to allow setting configuration
= libnereon API functions
* All API functions are defined in https://github.com/riboseinc/libnereon/blob/master/src/nereon.h[nereon.h].
* `NOS` configuration example is https://github.com/riboseinc/libnereon/blob/master/tests/rvd.nos[rvd.nos].
* `NOC` configuration example is https://github.com/riboseinc/libnereon/blob/master/tests/rvd.noc[rvd.noc].
* The example code is https://github.com/riboseinc/libnereon/blob/master/tests/noc_test.c[noc_test.c].NOTE: `NOS` configuration should be compiled with the projects which is using `libnereon`.
`nos2cc` converts `NOS` configuration to C source file. To convert `NOS` to C source file, it needs to execute the following command.----
nos2cc
----The project should compile `.c` and `.h`, and call `get__nos_cfg` function to get NOS contents.