mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-01-31 00:35:19 +01:00
Address review comments (#14426)
* Address review comments * Revert comments in `impl FromStr for ConfigValue`
This commit is contained in:
@@ -66,10 +66,6 @@ impl FromStr for ConfigValue {
|
||||
let raw =
|
||||
read_to_string(&path).fs_context("failed to read configuration file", path.clone())?;
|
||||
|
||||
// treat all other extensions as json
|
||||
// from tauri-utils/src/config/parse.rs:
|
||||
// we also want to support **valid** json5 in the .json extension
|
||||
// if the json5 is not valid the serde_json error for regular json will be returned.
|
||||
match path.extension().and_then(|ext| ext.to_str()) {
|
||||
Some("toml") => Ok(Self(::toml::from_str(&raw).with_context(|| {
|
||||
format!("failed to parse config at {} as TOML", path.display())
|
||||
@@ -77,11 +73,17 @@ impl FromStr for ConfigValue {
|
||||
Some("json5") => Ok(Self(::json5::from_str(&raw).with_context(|| {
|
||||
format!("failed to parse config at {} as JSON5", path.display())
|
||||
})?)),
|
||||
_ => Ok(Self(match ::json5::from_str(&raw) {
|
||||
Ok(json5) => json5,
|
||||
Err(_) => serde_json::from_str(&raw)
|
||||
.with_context(|| format!("failed to parse config at {} as JSON", path.display()))?,
|
||||
})),
|
||||
// treat all other extensions as json
|
||||
_ => Ok(Self(
|
||||
// from tauri-utils/src/config/parse.rs:
|
||||
// we also want to support **valid** json5 in the .json extension
|
||||
// if the json5 is not valid the serde_json error for regular json will be returned.
|
||||
match ::json5::from_str(&raw) {
|
||||
Ok(json5) => json5,
|
||||
Err(_) => serde_json::from_str(&raw)
|
||||
.with_context(|| format!("failed to parse config at {} as JSON", path.display()))?,
|
||||
},
|
||||
)),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -223,7 +225,7 @@ where
|
||||
Ok(s) => s,
|
||||
Err(e) => e.exit(),
|
||||
};
|
||||
|
||||
// set the verbosity level so subsequent CLI calls (xcode-script, android-studio-script) refer to it
|
||||
let verbosity_number = get_verbosity(cli.verbose);
|
||||
std::env::set_var("TAURI_CLI_VERBOSITY", verbosity_number.to_string());
|
||||
|
||||
@@ -231,10 +233,12 @@ where
|
||||
if let Err(err) = builder
|
||||
.format_indent(Some(12))
|
||||
.filter(None, verbosity_level(verbosity_number).to_level_filter())
|
||||
// golbin spams an insane amount of really technical logs on the debug level so we're reducing one level
|
||||
.filter(
|
||||
Some("goblin"),
|
||||
verbosity_level(verbosity_number.saturating_sub(1)).to_level_filter(),
|
||||
)
|
||||
// handlebars is not that spammy but its debug logs are typically far from being helpful
|
||||
.filter(
|
||||
Some("handlebars"),
|
||||
verbosity_level(verbosity_number.saturating_sub(1)).to_level_filter(),
|
||||
@@ -314,6 +318,8 @@ fn prettyprint_level(lvl: Level) -> &'static str {
|
||||
}
|
||||
|
||||
pub trait CommandExt {
|
||||
// The `pipe` function sets the stdout and stderr to properly
|
||||
// show the command output in the Node.js wrapper.
|
||||
fn piped(&mut self) -> std::io::Result<ExitStatus>;
|
||||
fn output_ok(&mut self) -> crate::Result<Output>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user