Support multiple configs with .erdtree.toml
#201
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #159
What's new
This PR introduced the following key-value pair to the list of command-line arguments:
In addition to supporting a
.erdtreerc
configuration file,erdtree
now supports a.erdtree.toml
TOML file as well. The.erdtree.toml
file, unlike.erdtreerc
, supports multiple configurations that you can specify using named tables. Here is an example of a valid.erdtree.toml
file:The top-level table only contains two arguments:
icons = true
andhuman = true
. Without providing any arguments to-c, --config
, the top-level table will get invoked which, after processing, will get transformed intoerd --icons --human
. To invoke configurations from a named table instead, pass the name of the table to-c, --config
. Here are some examples given the above.erdtree.toml
...
User provided arguments take precedent over config
Config rules
Unlike
.erdtreerc
,.erdtree.toml
only accepts long-named arguments without the preceding--
. Types are enforced, so numbers are expected to be numbers, booleans are expected to be booleans, strings are expected to be strings, and so on and so forth.If you have both a
.erdtreerc
and a.erdtree.toml
, the.erdtreerc
will be prioritized and.erdtree.toml
will be ignored. There is really no good reason for you to have both. Supporting.erdtreerc
hence-forth will be for backwards compatibility.This is the order wherein
erdtree
looks for the.erdtree.toml
file on Unix platforms:and on Windows: