mirror of
https://github.com/starship/starship.git
synced 2024-11-23 00:33:16 +01:00
feat(print-config): list expanded $all
variable (#2932)
* feat(print-config): list expanded `$all` variable * handle $custom * improve comment
This commit is contained in:
parent
85f7a4be39
commit
c6e5e6fbed
@ -5,6 +5,7 @@ use std::process;
|
||||
|
||||
use crate::config::RootModuleConfig;
|
||||
use crate::config::StarshipConfig;
|
||||
use crate::configs::PROMPT_ORDER;
|
||||
use crate::utils;
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
@ -70,7 +71,26 @@ pub fn print_configuration(use_default: bool) {
|
||||
|
||||
let string_config = toml::to_string_pretty(&config).unwrap();
|
||||
|
||||
println!("# Warning: This config does not include keys that have an unset value");
|
||||
println!("# Warning: This config does not include keys that have an unset value\n");
|
||||
println!(
|
||||
"# $all is shorthand for {}",
|
||||
PROMPT_ORDER
|
||||
.iter()
|
||||
.map(|module_name| format!("${}", module_name))
|
||||
.collect::<String>()
|
||||
);
|
||||
|
||||
// Unwrapping is fine because config is based on FullConfig
|
||||
let custom_modules = config.get("custom").unwrap().as_table().unwrap();
|
||||
if !use_default && !custom_modules.is_empty() {
|
||||
println!(
|
||||
"# $custom (excluding any modules already listed in `format`) is shorthand for {}",
|
||||
custom_modules
|
||||
.keys()
|
||||
.map(|module_name| format!("${{custom.{}}}", module_name))
|
||||
.collect::<String>()
|
||||
);
|
||||
}
|
||||
println!("{}", string_config);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user