GithubHelp home page GithubHelp logo

configurationthingywithoutnameyet's Introduction

name here

A simple to write, extendable configuration language.

Aims to reduce duplicated configuration.

Examples

# this is a comment

# simple 
default:
    a = "test"
    b = "something"

somename = "something"
somenamespace:
    a = 42
    b = "test"
    c = 3.14159265
    d = [1,2,3]
    e = {"a": "b", "c": "d"} # discouraged but allowed.
    
    # preferred
    f:
        a = "b"
        c = "d"
    
    g = None
    h = False
    i = True
    
    tester:
        extends default
        a = "b"
        
    # hexadecimal also works!
    j = 0x15
    # prefixed zeros don't matter
    k = 0x015
    # even octal works!
    l = 0o123
    # and binary
    m = 0b1010
    # scientific notation
    n = 1e10
    
    # setting keys to values
    o = n # now also 1e10, works through scopes

    # multiline lists
    p = [
        "a",
        "b",
        "c",
    ]
    # complex  value types
    q = [{"a": "b"}, 3, "f"]
    

Extends syntax

The main feature of is that it supports 'extends' syntax. Extends syntax looks like this:

extends something

An extends block looks through the defined scopes, for a block matching name, and copies all it's keys into the block the extend declartion is in. Any name defined in the block the extends statement is used, which clashes with a name from the extended block is overwritten. In the above example, default is extended. This means that this block now contains the a and b. The a key is overwritten.

Ideas:

  • extending from environment variables (1)
  • extending from files in the local directory (1)

1: These ideas only make sense when the config file is located in a directory of the filesystem. When parsing a config as a string they would obviously fail. Suggestions are welcome.

implementations

Currently only a Python implementation is available.

Scheduled are:
Rust
Javascript

configurationthingywithoutnameyet's People

Contributors

jdonszelmann avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.