-
-
Notifications
You must be signed in to change notification settings - Fork 147
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
console: configuration file #310
Comments
This would probably be a good first issue for anyone interested in helping contribute to the console. |
i’d like to take it. |
@nrskt That would be great! Please let me know if you have any questions! |
[Q1] Do you want to use the view options from the config file only? (Can I disable the options no_colors, ascii_only and etc?) I think both options are realized is ideal. But it's complex for me because I don't know how to use the default value from the config file using clap derive-style. First implementation:
How about it? [Q2] Can I use |
<a name="0.1.4"></a> ## 0.1.4 (2022-04-13) #### Features * add autogenerated example config file to docs (#327) ([79da280](79da280)) * add `gen-config` subcommand to generate a config file (#324) ([e034f8d](e034f8d)) * surface dropped event count if there are any (#316) ([16df5d3](16df5d3)) * read configuration options from a config file (#320) ([defe346](defe346), closes [#310](310))
<a name="0.1.4"></a> ## 0.1.4 (2022-04-13) #### Features * add autogenerated example config file to docs (#327) ([79da280](79da280)) * add `gen-config` subcommand to generate a config file (#324) ([e034f8d](e034f8d)) * surface dropped event count if there are any (#316) ([16df5d3](16df5d3)) * read configuration options from a config file (#320) ([defe346](defe346), closes [#310](310))
What problem are you trying to solve?
Currently, the
tokio-console
CLI honors a number of command-line arguments and environment variables to configure its behavior. These include view options, such as colors and UTF-8 support:console/tokio-console/src/config.rs
Lines 71 to 107 in 3c55912
In general, these kinds of configurations are typically not the sort of thing that users would want to pass a bunch of CLI flags for. Instead, users might want to set these configurations globally for their system.
How should the problem be solved?
We should support a configuration file for configuring the
tokio-console
CLI.Currently, the main things we would set in a config file are view options like colors and Unicode support, but as we add more features, there may be additional configuration surface area. In particular, #148 proposes the ability to control what warnings are enabled/disabled; we would almost certainly want to be able to configure this from a config file.
Any alternatives you've considered?
We could just not do this.
How would users interact with this feature?
TOML is probably a good configuration language for our purposes: as it's widely used for Rust tools and most Rust developers are probably already familiar with it; and we don't need to represent particularly complex configurations.
On Unix systems, we should probably use the
XDG_CONFIG_HOME
environment variable to determine where to look for the config file. This way, if the user's systems stores configs in a non-standard location, we'll be able to find the config file.We may also want to support overriding parts of the configuration with a config file in the current working directory. That way, users could have per-project configs for different projects, and (potentially) check them into source control. This could allow different projects to do things like enable or disable different sets of warnings. We would probably want to combine local configs with global ones in a way where the local configs override the global config in the case of conflicts. This could be a separate issue once basic config file support is implemented.
Would you like to work on this feature?
no
The text was updated successfully, but these errors were encountered: