Created
April 21, 2015 16:21
-
-
Save jordanorelli/80da9d092a614b1ec7dc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jorelli@ETSYNY-L645[0] /projects/moon: cat ex.moon | |
# ------------------------------------------------------------------------------ | |
# example config format | |
# | |
# this is a working draft of things that are valid in a new config language to | |
# replace json as a config language for Go projects. | |
# | |
# comments are a thing now! | |
# ------------------------------------------------------------------------------ | |
# the whole document is implicitly a namespace, so you can set key value pairs | |
# at the top level. | |
first_name: "jordan" | |
last_name: "orelli" | |
# lists of things should be supported | |
items: [ | |
"one" | |
2 | |
3.4 | |
["five" 6 7.8] | |
] | |
# objects should be supported | |
hash: {key: "value" other_key: "other_value"} | |
other_hash: { | |
key_1: "one" | |
key_2: 2 | |
key_3: 3.4 | |
key_4: ["five" 6 7.8] | |
} | |
# we may reference an item that was defined earlier | |
repeat_hash: hash | |
# items can be hidden. i.e., they're only valid in the parse and eval stage as | |
# intermediate values internal to the config file; they are *not* visible to | |
# the host program. This is generally useful for composing larger, more | |
# complicated things. | |
.hidden_item: "it has a value" | |
visible_item: .hidden_item | |
.person_one: { | |
name: "the first name here" | |
age: 28 | |
hometown: "crooklyn" | |
} | |
.person_two: { | |
name: "the second name here" | |
age: 30 | |
hometown: "tha bronx" | |
} | |
people: [.person_one .person_two] | |
jorelli@ETSYNY-L645[0] /projects/moon: moon to json ex.moon | |
{ | |
"first_name": "jordan", | |
"hash": { | |
"key": "value", | |
"other_key": "other_value" | |
}, | |
"items": [ | |
"one", | |
2, | |
3.4, | |
[ | |
"five", | |
6, | |
7.8 | |
] | |
], | |
"last_name": "orelli", | |
"other_hash": { | |
"key_1": "one", | |
"key_2": 2, | |
"key_3": 3.4, | |
"key_4": [ | |
"five", | |
6, | |
7.8 | |
] | |
}, | |
"people": [ | |
{ | |
"age": 28, | |
"hometown": "crooklyn", | |
"name": "the first name here" | |
}, | |
{ | |
"age": 30, | |
"hometown": "tha bronx", | |
"name": "the second name here" | |
} | |
], | |
"repeat_hash": { | |
"key": "value", | |
"other_key": "other_value" | |
}, | |
"visible_item": "it has a value" | |
} | |
jorelli@ETSYNY-L645[0] /projects/moon: moon get people ex.moon | |
[{name: "the first name here" age: 28 hometown: "crooklyn"} {name: "the second name here" age: 30 hometown: "tha bronx"}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment