cli: disable opening the tab by default, add some trace logging for config resolution (#2377)
This commit is contained in:
1 parent
74352f2f61
commit
1b82ad4ddd
2 files changed
+10
-13
No files matched your search
@@ -109,6 +109,7 @@ impl std::error::Error for CrateConfigError {}
|
|||||||
impl DioxusConfig {
|
impl DioxusConfig {
|
||||||
#[cfg(feature = "cli")]
|
#[cfg(feature = "cli")]
|
||||||
/// Load the dioxus config from a path
|
/// Load the dioxus config from a path
|
||||||
|
#[tracing::instrument]
|
||||||
pub fn load(bin: Option<PathBuf>) -> Result<Option<DioxusConfig>, CrateConfigError> {
|
pub fn load(bin: Option<PathBuf>) -> Result<Option<DioxusConfig>, CrateConfigError> {
|
||||||
let crate_dir = crate::cargo::crate_root();
|
let crate_dir = crate::cargo::crate_root();
|
||||||
|
|
||||||
@@ -125,6 +126,7 @@ impl DioxusConfig {
|
|||||||
let crate_dir = crate_dir.as_path();
|
let crate_dir = crate_dir.as_path();
|
||||||
|
|
||||||
let Some(dioxus_conf_file) = acquire_dioxus_toml(crate_dir) else {
|
let Some(dioxus_conf_file) = acquire_dioxus_toml(crate_dir) else {
|
||||||
|
tracing::warn!(?crate_dir, "no dioxus config found for");
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -158,20 +160,15 @@ impl DioxusConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "cli")]
|
#[cfg(feature = "cli")]
|
||||||
|
#[tracing::instrument]
|
||||||
fn acquire_dioxus_toml(dir: &std::path::Path) -> Option<PathBuf> {
|
fn acquire_dioxus_toml(dir: &std::path::Path) -> Option<PathBuf> {
|
||||||
// prefer uppercase
|
use tracing::trace;
|
||||||
let uppercase_conf = dir.join("Dioxus.toml");
|
|
||||||
if uppercase_conf.is_file() {
|
|
||||||
return Some(uppercase_conf);
|
|
||||||
}
|
|
||||||
|
|
||||||
// lowercase is fine too
|
["Dioxus.toml", "dioxus.toml"]
|
||||||
let lowercase_conf = dir.join("dioxus.toml");
|
.into_iter()
|
||||||
if lowercase_conf.is_file() {
|
.map(|file| dir.join(file))
|
||||||
return Some(lowercase_conf);
|
.inspect(|path| trace!("checking [{path:?}]"))
|
||||||
}
|
.find(|path| path.is_file())
|
||||||
|
|
||||||
None
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for DioxusConfig {
|
impl Default for DioxusConfig {
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ pub struct ConfigOptsServe {
|
|||||||
pub port: u16,
|
pub port: u16,
|
||||||
|
|
||||||
/// Open the app in the default browser [default: true]
|
/// Open the app in the default browser [default: true]
|
||||||
#[clap(long, default_value_t = true)]
|
#[clap(long, default_value_t = false)]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub open: bool,
|
pub open: bool,
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user