#setting #cnf #dot-file

dotecnf

loader for ".ecnf" file such as ".env". ".ecnf" is key-value setting file with key's hierarchy.

1 unstable release

0.1.1 Nov 24, 2019

#555 in Configuration

MIT license

11KB
211 lines

dotecnf

What is .ecnf

".ecnf" is "Environment CoNFig" file such as ".env" file. .env is simple key-value store. So .enc cannot treat "key = {key = value}" and "key="(value is null). It is not useful. .ecnf is my original formatting file. .ecnf can treat them which .env cannot treat. .ecnf has following format.

# comment
# null (None)
ONLY_UPPER_START :

# empty string
EMPTY: ""

# not empty string
NOT_EMPTY :"value"

# fail
# sTart: 
# _START :""

ZERO : {
    FIRST : ""
    SECOND: {
        THIRD: "日本語"
    }
    FOURTH :
}

SUCCESS: {
}

# ERROR: {}

usage

// init
let mut loader = ECnfLoader::new();

// load: self.from<R: Read>(R), self.load_from_file(&Path), self.load_from_str(&str))
loader.load_from_str(input);

let ecnf: HashMap<String, Option<String>> = loader.build_ecnf();
// use ecnf...

Dependencies

~64KB