Use PathBuf instead of String for CliArgs::config_file

main
Elnu 1 year ago
parent c0d20759a1
commit 5d64a8ed1f

@ -2,7 +2,7 @@ use clap::Parser;
use log::{debug, error, warn}; use log::{debug, error, warn};
use reqwest::blocking::Client; use reqwest::blocking::Client;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::process::Command; use std::{process::Command, path::PathBuf};
fn main() -> Result<(), Box<dyn std::error::Error>> { fn main() -> Result<(), Box<dyn std::error::Error>> {
let args = CliArgs::parse(); let args = CliArgs::parse();
@ -19,7 +19,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
); );
} }
debug!("Opening Config file: {}", args.config_file); debug!("Opening Config file: {}", args.config_file.display());
debug!( debug!(
"Config file exists: {}", "Config file exists: {}",
std::fs::metadata(&args.config_file).is_ok() std::fs::metadata(&args.config_file).is_ok()
@ -140,7 +140,7 @@ struct Config {
struct CliArgs { struct CliArgs {
/// Path to config .toml file /// Path to config .toml file
#[arg(short, long)] #[arg(short, long)]
config_file: String, config_file: PathBuf,
#[arg(short, long)] #[arg(short, long)]
hddtemp_executable: String, hddtemp_executable: String,

Loading…
Cancel
Save