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 {
|
||||
#[cfg(feature = "cli")]
|
||||
/// Load the dioxus config from a path
|
||||
#[tracing::instrument]
|
||||
pub fn load(bin: Option<PathBuf>) -> Result<Option<DioxusConfig>, CrateConfigError> {
|
||||
let crate_dir = crate::cargo::crate_root();
|
||||
|
||||
@@ -125,6 +126,7 @@ impl DioxusConfig {
|
||||
let crate_dir = crate_dir.as_path();
|
||||
|
||||
let Some(dioxus_conf_file) = acquire_dioxus_toml(crate_dir) else {
|
||||
tracing::warn!(?crate_dir, "no dioxus config found for");
|
||||
return Ok(None);
|
||||
};
|
||||
|
||||
@@ -158,20 +160,15 @@ impl DioxusConfig {
|
||||
}
|
||||
|
||||
#[cfg(feature = "cli")]
|
||||
#[tracing::instrument]
|
||||
fn acquire_dioxus_toml(dir: &std::path::Path) -> Option<PathBuf> {
|
||||
// prefer uppercase
|
||||
let uppercase_conf = dir.join("Dioxus.toml");
|
||||
if uppercase_conf.is_file() {
|
||||
return Some(uppercase_conf);
|
||||
}
|
||||
use tracing::trace;
|
||||
|
||||
// lowercase is fine too
|
||||
let lowercase_conf = dir.join("dioxus.toml");
|
||||
if lowercase_conf.is_file() {
|
||||
return Some(lowercase_conf);
|
||||
}
|
||||
|
||||
None
|
||||
["Dioxus.toml", "dioxus.toml"]
|
||||
.into_iter()
|
||||
.map(|file| dir.join(file))
|
||||
.inspect(|path| trace!("checking [{path:?}]"))
|
||||
.find(|path| path.is_file())
|
||||
}
|
||||
|
||||
impl Default for DioxusConfig {
|
||||
|
||||
@@ -86,7 +86,7 @@ pub struct ConfigOptsServe {
|
||||
pub port: u16,
|
||||
|
||||
/// Open the app in the default browser [default: true]
|
||||
#[clap(long, default_value_t = true)]
|
||||
#[clap(long, default_value_t = false)]
|
||||
#[serde(default)]
|
||||
pub open: bool,
|
||||
|
||||
|
||||
Reference in new issue
Block a user