42 releases (6 breaking)

✓ Uses Rust 2018 edition

0.6.4 Aug 12, 2019
0.6.3 Jun 21, 2019
0.6.2 May 30, 2019
0.5.7 Mar 1, 2019
0.0.4 Mar 29, 2018

#12 in Configuration

Download history 9/week @ 2019-04-29 38/week @ 2019-05-06 54/week @ 2019-05-13 108/week @ 2019-05-20 101/week @ 2019-05-27 83/week @ 2019-06-03 41/week @ 2019-06-10 132/week @ 2019-06-17 267/week @ 2019-06-24 197/week @ 2019-07-01 269/week @ 2019-07-08 2/week @ 2019-07-15 41/week @ 2019-07-22 43/week @ 2019-07-29 142/week @ 2019-08-05

493 downloads per month

Apache-2.0

355KB
9K SLoC

Universal Configuration Grammar.

Build Status

This is an experiment in configuration management. The approach is not to create a "parsable" config file format. We have plenty of those. Instead we try to specify a grammar for describing configuration values that can then target various configuration formats to output to.

In theory this could support anything from command line flags to json to yaml or toml or even xml.

The goal is to allow a global shared configuration repository that can be version controlled, enforce some typesafety, and output configuration for any application regardless of that applications preferred format.

The Usual Warnings

This is still very much an experiment and the language and api can be expected to change and mutate. You have been warned.

Usage

You can get ucg with cargo cargo install ucg.

Running ucg help will show the following output.

Universal Configuration Grammar compiler.

USAGE:
    ucg [FLAGS] [SUBCOMMAND]

FLAGS:
    -h, --help         Prints help information
        --no-strict    Turn off strict checking.
    -V, --version      Prints version information

SUBCOMMANDS:
    build         Build a list of ucg files.
    converters    list the available converters
    env           Describe the environment variables ucg uses.
    eval          Evaluate an expression with an optional ucg file as context.
    fmt           Format ucg files automatically.
    help          Prints this message or the help of the given subcommand(s)
    importers     list the available importers for includes
    repl          Start the ucg repl for interactive evaluation.
    test          Check a list of ucg files for errors and run test assertions.

Compiling

Build a list of ucg files.

USAGE:
    ucg build [FLAGS] -r [INPUT]...

FLAGS:
    -h, --help       Prints help information
    -r               Whether we should recurse in directories or not.
    -V, --version    Prints version information

ARGS:
    <INPUT>...    Input ucg files or directories to build. If not provided then build the contents of the current directory.

Run the repl

$> ucg repl
ucg> 1 + 1;
2
ucg> {foo = 1 + 1};
{
        foo = 2,
}
ucg> 

Testing

 Check a list of ucg files for errors and run test assertions.

USAGE:
    ucg test [FLAGS] -r [INPUT]...

FLAGS:
    -h, --help       Prints help information
    -r               Whether we should recurse or not.
    -V, --version    Prints version information

ARGS:
    <INPUT>...    Input ucg files or directories to run test assertions for. If not provided it will scan the current directory for files with _test.ucg

Language Reference

https://ucg.marzhillstudios.com/reference

Dependencies

~5–6.5MB
~131K SLoC