refactor: move base path config + documentation

This commit is contained in:
Thomas Frans
2023-05-27 14:15:55 +02:00
committed by Henrik Friedrichsen
parent 6be45ece90
commit 04cbe8ac20
4 changed files with 29 additions and 19 deletions

View File

@@ -7,7 +7,7 @@ extern crate serde;
use std::path::PathBuf;
use application::Application;
use application::{setup_logging, Application};
use ncspot::program_arguments;
mod application;
@@ -43,13 +43,20 @@ fn main() -> Result<(), String> {
// stdout is most likely in use by Cursive.
panic::register_backtrace_panic_handler();
// Parse the command line arguments.
let matches = program_arguments().get_matches();
// Enable debug logging to a file if specified on the command line.
if let Some(filename) = matches.get_one::<PathBuf>("debug") {
setup_logging(filename).expect("logger could not be initialized");
}
// Create the application.
let mut application = Application::new(
matches.get_one::<PathBuf>("debug").cloned(),
matches.get_one::<PathBuf>("basepath").cloned(),
matches.get_one::<PathBuf>("config").cloned(),
)?;
// Start the application event loop.
application.run()
}