Skip to content

Commit

Permalink
fix(print-config): use proper defaults for top-level values (starship…
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkna authored Apr 26, 2021
1 parent e5017e0 commit cd50b35
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 1 deletion.
70 changes: 69 additions & 1 deletion src/configs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub mod zig;

pub use starship_root::*;

#[derive(Default, Serialize, ModuleConfig, Clone)]
#[derive(Serialize, ModuleConfig, Clone)]
#[serde(default)]
pub struct FullConfig<'a> {
// Root config
Expand Down Expand Up @@ -132,3 +132,71 @@ pub struct FullConfig<'a> {
zig: zig::ZigConfig<'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(),
}
}
}
1 change: 1 addition & 0 deletions src/configs/starship_root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ pub const PROMPT_ORDER: &[&str] = &[
"character",
];

// On changes please also update `Default` for the `FullConfig` struct in `mod.rs`
impl<'a> Default for StarshipRootConfig<'a> {
fn default() -> Self {
StarshipRootConfig {
Expand Down

0 comments on commit cd50b35

Please sign in to comment.