Use default_config.nu by default (#4675)

* Use default_config.nu by default

* Fix default color
This commit is contained in:
JT 2022-02-28 10:12:08 -05:00 committed by GitHub
parent d6a6c4b034
commit 0924975b4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -92,15 +92,24 @@ pub(crate) fn read_config_file(
.read_line(&mut answer) .read_line(&mut answer)
.expect("Failed to read user input"); .expect("Failed to read user input");
let config_file = include_str!("default_config.nu");
match answer.to_lowercase().trim() { match answer.to_lowercase().trim() {
"y" | "" => { "y" | "" => {
let mut output = File::create(&config_path).expect("Unable to create file"); let mut output = File::create(&config_path).expect("Unable to create file");
let config_file = include_str!("default_config.nu");
write!(output, "{}", config_file).expect("Unable to write to config file"); write!(output, "{}", config_file).expect("Unable to write to config file");
println!("Config file created at: {}", config_path.to_string_lossy()); println!("Config file created at: {}", config_path.to_string_lossy());
} }
_ => { _ => {
println!("Continuing without config file"); println!("Continuing without config file");
// Just use the contents of "default_config.nu"
eval_source(
engine_state,
stack,
config_file.as_bytes(),
"default_config.nu",
PipelineData::new(Span::new(0, 0)),
);
return; return;
} }
} }

View File

@ -138,7 +138,7 @@ let default_theme = {
shape_int: purple_bold shape_int: purple_bold
shape_float: purple_bold shape_float: purple_bold
shape_range: yellow_bold shape_range: yellow_bold
shape_internalcall: cyna_bold shape_internalcall: cyan_bold
shape_external: cyan shape_external: cyan
shape_externalarg: green_bold shape_externalarg: green_bold
shape_literal: blue shape_literal: blue