2018-03-12 20:46:51 -05:00
|
|
|
# Universal Configuration Grammar.
|
2017-07-11 20:29:54 -05:00
|
|
|
|
2018-08-03 13:57:35 -05:00
|
|
|
[](https://travis-ci.org/zaphar/ucg)
|
|
|
|
|
2017-07-29 13:20:57 -05:00
|
|
|
This is an experiment in configuration management. The approach is **not**
|
2017-07-11 20:29:54 -05:00
|
|
|
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
|
2017-07-29 13:20:57 -05:00
|
|
|
be version controlled, enforce _some_ typesafety, and output
|
2017-07-11 20:29:54 -05:00
|
|
|
configuration for any application regardless of that applications
|
|
|
|
preferred format.
|
|
|
|
|
2018-03-12 20:46:51 -05:00
|
|
|
## The Usual Warnings
|
|
|
|
|
|
|
|
This is still very much an experiment and the language and api can be expected
|
2019-05-31 15:36:57 -05:00
|
|
|
to change and mutate. You have been warned.
|
2018-03-12 20:46:51 -05:00
|
|
|
|
2018-02-13 17:47:52 -06:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
You can get ucg with cargo `cargo install ucg`.
|
|
|
|
|
|
|
|
Running ucg help will show the following output.
|
|
|
|
|
|
|
|
```sh
|
|
|
|
Universal Configuration Grammar compiler.
|
|
|
|
|
|
|
|
USAGE:
|
2019-01-30 21:00:01 -06:00
|
|
|
ucg [FLAGS] [SUBCOMMAND]
|
2018-02-13 17:47:52 -06:00
|
|
|
|
|
|
|
FLAGS:
|
2019-01-30 21:00:01 -06:00
|
|
|
-h, --help Prints help information
|
|
|
|
--no-strict Turn off strict checking.
|
|
|
|
-V, --version Prints version information
|
2018-02-13 17:47:52 -06:00
|
|
|
|
|
|
|
SUBCOMMANDS:
|
2019-01-30 21:00:01 -06:00
|
|
|
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.
|
2019-05-24 15:46:29 -05:00
|
|
|
fmt Format ucg files automatically.
|
2019-01-30 21:00:01 -06:00
|
|
|
help Prints this message or the help of the given subcommand(s)
|
|
|
|
importers list the available importers for includes
|
2019-05-26 16:25:28 -05:00
|
|
|
repl Start the ucg repl for interactive evaluation.
|
2019-01-30 21:00:01 -06:00
|
|
|
test Check a list of ucg files for errors and run test assertions.
|
2018-02-13 17:47:52 -06:00
|
|
|
```
|
|
|
|
|
2018-08-17 22:17:25 -05:00
|
|
|
## Compiling
|
2018-07-04 12:48:33 -05:00
|
|
|
|
|
|
|
```sh
|
2018-08-15 18:54:08 -05:00
|
|
|
Build a list of ucg files.
|
2018-07-04 12:48:33 -05:00
|
|
|
|
|
|
|
USAGE:
|
2018-08-17 22:17:25 -05:00
|
|
|
ucg build [FLAGS] -r [INPUT]...
|
2018-07-04 12:48:33 -05:00
|
|
|
|
|
|
|
FLAGS:
|
|
|
|
-h, --help Prints help information
|
2018-08-17 22:17:25 -05:00
|
|
|
-r Whether we should recurse in directories or not.
|
2018-07-04 12:48:33 -05:00
|
|
|
-V, --version Prints version information
|
|
|
|
|
|
|
|
ARGS:
|
2018-08-17 22:17:25 -05:00
|
|
|
<INPUT>... Input ucg files or directories to build. If not provided then build the contents of the current directory.
|
2018-07-04 12:48:33 -05:00
|
|
|
```
|
|
|
|
|
2019-05-26 16:25:28 -05:00
|
|
|
## Run the repl
|
|
|
|
|
|
|
|
```sh
|
|
|
|
$> ucg repl
|
|
|
|
ucg> 1 + 1;
|
|
|
|
2
|
|
|
|
ucg> {foo = 1 + 1};
|
|
|
|
{
|
|
|
|
foo = 2,
|
|
|
|
}
|
|
|
|
ucg>
|
|
|
|
```
|
|
|
|
|
2018-08-24 19:47:15 -05:00
|
|
|
## Testing
|
2019-03-04 20:39:54 -06:00
|
|
|
```sh
|
2018-11-06 22:09:00 -06:00
|
|
|
Check a list of ucg files for errors and run test assertions.
|
2018-08-17 22:17:25 -05:00
|
|
|
|
|
|
|
USAGE:
|
2018-08-24 19:47:15 -05:00
|
|
|
ucg test [FLAGS] -r [INPUT]...
|
2018-08-17 22:17:25 -05:00
|
|
|
|
|
|
|
FLAGS:
|
|
|
|
-h, --help Prints help information
|
|
|
|
-r Whether we should recurse or not.
|
|
|
|
-V, --version Prints version information
|
|
|
|
|
|
|
|
ARGS:
|
2018-08-24 19:47:15 -05:00
|
|
|
<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
|
2018-11-06 22:09:00 -06:00
|
|
|
```
|
2018-08-17 22:17:25 -05:00
|
|
|
|
2018-03-11 20:39:50 -05:00
|
|
|
## Language Reference
|
2017-07-11 20:29:54 -05:00
|
|
|
|
2019-01-04 10:16:57 -06:00
|
|
|
[https://ucg.marzhillstudios.com/reference](https://ucg.marzhillstudios.com/reference)
|