One config file to generate them all.
A program for managing config files across multiple repositories with the flexibility to extend and customize predefined configurations.
The idea is that a single config file can be used to control and generate all the necessary settings for a repository, reducing the need to manually manage multiple files.
cargo install onecfg
In short, a onecfg file (e.g. onecfg.json
) allows for the automatic generation
of config files as follows:
onecfg onecfg.json
json
{
"defines": {
".prettierrc.json": {"format": "json"}
}
}
json
{
"patches": {
".prettierrc.json": [
{"value": {"printWidth": 80}},
{"value": {"singleQuote": true}}
]
}
}
json
{
"extends": [
"https://raw.githubusercontent.com/clebert/onecfg-lib/main/lib/onecfg-editorconfig.json",
"https://raw.githubusercontent.com/clebert/onecfg-lib/main/lib/onecfg-git.json",
"https://raw.githubusercontent.com/clebert/onecfg-lib/main/lib/onecfg-prettier.json",
"https://raw.githubusercontent.com/clebert/onecfg-lib/main/lib/onecfg-vscode.json"
]
}
Note: You can use JSON Schema to validate your onecfg file or enable autocompletion in the editor.
text
json
{
"defines": {
"test.txt": {"format": "text"}
},
"patches": {
"test.txt": [{"value": "foo"}, {"value": "bar"}]
}
}
bar
json
json
{
"defines": {
"test.json": {"format": "json"}
},
"patches": {
"test.json": [{"value": {"foo": "bar"}}, {"value": {"baz": "qux"}}]
}
}
json
{
"baz": "qux",
"foo": "bar"
}
toml
json
{
"defines": {
"test.toml": {"format": "toml"}
},
"patches": {
"test.toml": [{"value": {"foo": "bar"}}, {"value": {"baz": "qux"}}]
}
}
toml
baz = "qux"
foo = "bar"
yaml
json
{
"defines": {
"test.yml": {"format": "yaml"}
},
"patches": {
"test.yml": [{"value": {"foo": "bar"}}, {"value": {"baz": "qux"}}]
}
}
yaml
baz: qux
foo: bar
ignorefile
json
{
"defines": {
".testignore": {"format": "ignorefile"}
},
"patches": {
".testignore": [{"value": ["foo", "bar"]}, {"value": ["baz"]}]
}
}
foo
bar
baz
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.