feat(config): allow printing default and computed config #2521
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.
Description
This PR adds
starship print-config
to print the computed config andstarship print-config --default
to print the default config.I made a new struct in
src/configs/mod.rs
that contains all the module configs and implementsserve::Serialize
andModuleConfig
.Options that have a
None
value need to be skipped because toml doesn't supportNone
values and a warning comment about this is added at the top of the generated config files.Before formatting as toml the struct needs to be converted into a
toml::Value
because otherwise the toml crate won't be able to properly handle printing the top-level root options.I also got rid of the wrapper struct in
custom.rs
because the other modules don't use this forextensiosn
,folders
andextensions
either.Motivation and Context
Closes #2309
Related to #1921
Screenshots (if appropriate):
How Has This Been Tested?
Checklist: