mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
cli_helpers: run_with_cli_and_config: rename function and "f" argument
This commit is contained in:
parent
688372bdf2
commit
834a8c3fa2
2 changed files with 5 additions and 5 deletions
|
|
@ -7,7 +7,7 @@ static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
|||
|
||||
|
||||
fn main(){
|
||||
cli_helpers::run_with_cli_and_config::<aquatic::config::Config>(
|
||||
cli_helpers::run_app_with_cli_and_config::<aquatic::config::Config>(
|
||||
"aquatic: udp bittorrent tracker",
|
||||
aquatic::run,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -36,10 +36,10 @@ fn default_config_as_toml<T>() -> String
|
|||
}
|
||||
|
||||
|
||||
pub fn run_with_cli_and_config<T>(
|
||||
pub fn run_app_with_cli_and_config<T>(
|
||||
title: &str,
|
||||
// Function that takes config file and runs application
|
||||
f: fn(T),
|
||||
app_fn: fn(T),
|
||||
) where T: Default + Serialize + DeserializeOwned {
|
||||
let args: Vec<String> = ::std::env::args().collect();
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ pub fn run_with_cli_and_config<T>(
|
|||
print!("{}", default_config_as_toml::<T>());
|
||||
} else if let Some(config_file) = opts.config_file {
|
||||
match config_from_toml_file(config_file){
|
||||
Ok(config) => f(config),
|
||||
Ok(config) => app_fn(config),
|
||||
Err(err) => {
|
||||
eprintln!("Error while reading config file: {}", err);
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ pub fn run_with_cli_and_config<T>(
|
|||
}
|
||||
}
|
||||
} else {
|
||||
f(T::default())
|
||||
app_fn(T::default())
|
||||
}
|
||||
},
|
||||
Err(err) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue