1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-12-26 03:27:30 +00:00

fix(print-config): use proper defaults for top-level values (#2605)

This commit is contained in:
David Knaack 2021-04-26 19:55:22 +02:00 committed by GitHub
parent e5017e0155
commit cd50b354a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 70 additions and 1 deletions

View File

@ -65,7 +65,7 @@ pub mod zig;
pub use starship_root::*; pub use starship_root::*;
#[derive(Default, Serialize, ModuleConfig, Clone)] #[derive(Serialize, ModuleConfig, Clone)]
#[serde(default)] #[serde(default)]
pub struct FullConfig<'a> { pub struct FullConfig<'a> {
// Root config // Root config
@ -132,3 +132,71 @@ pub struct FullConfig<'a> {
zig: zig::ZigConfig<'a>, zig: zig::ZigConfig<'a>,
custom: IndexMap<String, custom::CustomConfig<'a>>, custom: IndexMap<String, custom::CustomConfig<'a>>,
} }
impl<'a> Default for FullConfig<'a> {
fn default() -> Self {
Self {
format: "$all",
scan_timeout: 30,
command_timeout: 500,
add_newline: true,
aws: Default::default(),
battery: Default::default(),
character: Default::default(),
cmake: Default::default(),
cmd_duration: Default::default(),
conda: Default::default(),
crystal: Default::default(),
dart: Default::default(),
deno: Default::default(),
directory: Default::default(),
docker_context: Default::default(),
dotnet: Default::default(),
elixir: Default::default(),
elm: Default::default(),
env_var: Default::default(),
erlang: Default::default(),
gcloud: Default::default(),
git_branch: Default::default(),
git_commit: Default::default(),
git_state: Default::default(),
git_status: Default::default(),
golang: Default::default(),
helm: Default::default(),
hg_branch: Default::default(),
hostname: Default::default(),
java: Default::default(),
jobs: Default::default(),
julia: Default::default(),
kotlin: Default::default(),
kubernetes: Default::default(),
lua: Default::default(),
memory_usage: Default::default(),
nim: Default::default(),
nix_shell: Default::default(),
nodejs: Default::default(),
ocaml: Default::default(),
openstack: Default::default(),
package: Default::default(),
perl: Default::default(),
php: Default::default(),
purescript: Default::default(),
python: Default::default(),
ruby: Default::default(),
rust: Default::default(),
scala: Default::default(),
shell: Default::default(),
shlvl: Default::default(),
singularity: Default::default(),
status: Default::default(),
swift: Default::default(),
terraform: Default::default(),
time: Default::default(),
username: Default::default(),
vagrant: Default::default(),
zig: Default::default(),
custom: Default::default(),
}
}
}

View File

@ -81,6 +81,7 @@ pub const PROMPT_ORDER: &[&str] = &[
"character", "character",
]; ];
// On changes please also update `Default` for the `FullConfig` struct in `mod.rs`
impl<'a> Default for StarshipRootConfig<'a> { impl<'a> Default for StarshipRootConfig<'a> {
fn default() -> Self { fn default() -> Self {
StarshipRootConfig { StarshipRootConfig {