-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for TOML config #209
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
peckto
reviewed
Jul 7, 2022
rumpelsepp
force-pushed
the
cli
branch
10 times, most recently
from
July 7, 2022 10:44
30a94c2
to
a329b52
Compare
@peckto It is done. here you can see it in action: 735ff48 Show all defaults for all commands:
Print a template with all config settings, commented.
If you create a config file and set a value there, you should see the default value changing. Example:
|
rumpelsepp
force-pushed
the
config-file
branch
6 times, most recently
from
July 8, 2022 05:30
df3002b
to
01e8a3a
Compare
rumpelsepp
force-pushed
the
config-file
branch
4 times, most recently
from
July 8, 2022 06:23
755f4f7
to
f69fa12
Compare
rumpelsepp
force-pushed
the
cli
branch
2 times, most recently
from
July 8, 2022 06:31
67ecdb5
to
265ca48
Compare
rumpelsepp
force-pushed
the
cli
branch
3 times, most recently
from
August 17, 2022 10:40
68ab86f
to
0b6d17a
Compare
rumpelsepp
force-pushed
the
config-file
branch
from
August 17, 2022 10:54
e1fd041
to
df3886a
Compare
rumpelsepp
force-pushed
the
config-file
branch
from
August 17, 2022 11:10
8025140
to
4e872d5
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Depends on #9
An optional config file can be created in the following locations; the first one which is found will be used. It is searched in these locations in this particular order.
$PWD/gallia.toml
$current_git_root/gallia.toml
~/.config/gallia/gallia.toml
($XDG_CONFIG_HOME
is recognized according to the XDG standard)/etc/xdg/gallia/gallia.toml
A path can be enforced by setting the environment variable
GALLIA_CONFIG
(the env variable avoids a chicken and egg problem with theArgumentParser
).The config is used only for setting the defaults for the cli args. The cli flags have the highest priority, all config values have a corresponding flag. The
argparse.Namespace
object will stay as the source of truth for all configuration values. I suggest namespacing the configuration values.A config template can be created like this: