1 unstable release

0.1.0 Jun 27, 2023

#679 in Configuration

MIT/Apache

16KB
409 lines

github Crates.io

binify

A tool to convert config file attributes to binaries.

Have you ever had the need to read values from a config file during shell scripting?

Now you can:

config.json

{
  "some": {
    "value": "read me!"
  }
}

yourscript.sh

binify config.json
echo $(some.value)

Output: read me!

Installation

From crates.io

cargo install binify

Example

JSON

some.json

{
  "foo": "bar",
  "baz": {
    "quz": "qork"
  },
  "boo": [
    "bah",
    {
      "lol": "lurg"
    }
  ]
}

$ binify some.json

Generates:

$ ls
foo
baz.quz
boo.0
boo.1.lol

Outputs:

$ ./foo
bar

$ ./baz.quz
qork

$ ./boo.0
bah

$ ./boo.1.lol
lurg

Env

example.env

FOO=BAR
BAZ=BORG

$ binify example.env

Generates:

$ ls
FOO
BAZ

Outputs:

$ ./FOO
BAR

$ ./BAZ
BORG

Disclaimer

Do not generate binaries from unknown files

Dependencies

~1.5–2.4MB
~47K SLoC