remove anyhow
This commit is contained in:
parent
be95c817dd
commit
acdd5e29f8
4 changed files with 8 additions and 19 deletions
7
Cargo.lock
generated
7
Cargo.lock
generated
|
@ -89,12 +89,6 @@ dependencies = [
|
|||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.98"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
|
||||
|
||||
[[package]]
|
||||
name = "async-broadcast"
|
||||
version = "0.7.2"
|
||||
|
@ -2875,7 +2869,6 @@ dependencies = [
|
|||
name = "worf"
|
||||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clap",
|
||||
"crossbeam",
|
||||
"dirs 6.0.0",
|
||||
|
|
|
@ -30,7 +30,6 @@ no-deps = true
|
|||
gtk4 = { version = "0.9.5", default-features = true, features = ["v4_6"] }
|
||||
gtk4-layer-shell = "0.5.0"
|
||||
gdk4 = "0.9.6"
|
||||
anyhow = "1.0.97"
|
||||
env_logger = "0.11.8"
|
||||
log = "0.4.27"
|
||||
regex = "1.11.1"
|
||||
|
|
|
@ -836,9 +836,10 @@ pub fn expand_path(input: &str) -> PathBuf {
|
|||
/// # Errors
|
||||
///
|
||||
/// Will return Err when it fails to merge the config with the arguments.
|
||||
pub fn merge_config_with_args(config: &mut Config, args: &Config) -> anyhow::Result<Config> {
|
||||
let args_json = serde_json::to_value(args)?;
|
||||
let mut config_json = serde_json::to_value(config)?;
|
||||
pub fn merge_config_with_args(config: &mut Config, args: &Config) -> Result<Config, Error> {
|
||||
let args_json = serde_json::to_value(args).map_err(|e| Error::ParsingError(e.to_string()))?;
|
||||
let mut config_json =
|
||||
serde_json::to_value(config).map_err(|e| Error::ParsingError(e.to_string()))?;
|
||||
|
||||
merge_json(&mut config_json, &args_json);
|
||||
Ok(serde_json::from_value(config_json).unwrap_or_default())
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
use std::env;
|
||||
|
||||
use anyhow::anyhow;
|
||||
|
||||
use worf::{Error, config, config::Mode, desktop::fork_if_configured, modes};
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
fn main() {
|
||||
env_logger::Builder::new()
|
||||
.parse_filters(&env::var("RUST_LOG").unwrap_or_else(|_| "error".to_owned()))
|
||||
.format_timestamp_micros()
|
||||
|
@ -23,7 +21,7 @@ fn main() -> anyhow::Result<()> {
|
|||
|
||||
if config.version() {
|
||||
println!("worf version {}", env!("CARGO_PKG_VERSION"));
|
||||
return Ok(());
|
||||
return;
|
||||
}
|
||||
|
||||
fork_if_configured(&config); // may exit the program
|
||||
|
@ -49,13 +47,11 @@ fn main() -> anyhow::Result<()> {
|
|||
log::info!("no selection made");
|
||||
} else {
|
||||
log::error!("Error occurred {err:?}");
|
||||
return Err(anyhow!("Error occurred {err:?}"));
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
} else {
|
||||
log::error!("No mode provided");
|
||||
Ok(())
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue