TOML八卦
配置文件大家也要玩出花儿了,这里有YAML八卦 。今天再看看另外一个 TOML
TOML: [Tom's Obvious Minimal Language] By Tom Preston-Werner, Jeklly的作者,Github联合创始人,2014年离开Github,后作为联合创始人创建了语言学习软件chatterbug
Julie Ann Horvath, a GitHub programmer, alleged in March 2014 that Tom Preston-Werner and his wife Theresa engaged in a pattern of harassment against her that led her to leave the company.[26][27] GitHub initially denied Horvath's allegations,[28][29][30] then following an internal investigation, confirmed some of the claims. Preston-Werner resigned. GitHub's new CEO Chris Wanstrath said the "investigation found Tom Preston-Werner in his capacity as GitHub's CEO acted inappropriately, including confrontational conduct, disregard of workplace complaints, insensitivity to the impact of his spouse's presence in the workplace, and failure to enforce an agreement that his spouse should not work in the office."[6]
官方示例:
# This is a TOML document
title = "TOML Example"
[owner]
name = "Tom Preston-Werner"
dob = 1979-05-27T07:32:00-08:00
[database]
enabled = true
ports = [ 8001, 8001, 8002 ]
data = [ ["delta", "phi"], [3.14] ]
temp_targets = { cpu = 79.5, case = 72.0 }
[servers]
[servers.alpha]
ip = "10.0.0.1"
role = "frontend"
[servers.beta]
ip = "10.0.0.2"
role = "backend"
-
TOML aims to be a minimal configuration file format that's easy to read due to obvious semantics.
-
TOML is designed to map unambiguously to a hash table.
-
TOML should be easy to parse into data structures in a wide variety of languages.
-
语义明显容易读
-
无歧义地映射为hash表
-
多语言支持(toml wiki on Github)
目前项目中使用https://github.com/BurntSushi/toml做解析支持