Files
ncspot/src/main.rs
Thomas Frans 2a4178e069 style: share linting options across packages
Move the Rust and Clippy linting options into the Cargo manifest and
share them with all the packages in the workspace. This ensures a
consistent style in all packages.
2024-01-09 09:22:06 +01:00

70 lines
1.7 KiB
Rust

#[macro_use]
extern crate cursive;
#[macro_use]
extern crate serde;
use std::path::PathBuf;
use application::{setup_logging, Application};
use config::set_configuration_base_path;
use ncspot::program_arguments;
mod application;
mod authentication;
mod cli;
mod command;
mod commands;
mod config;
mod events;
mod ext_traits;
mod library;
mod model;
mod panic;
mod queue;
mod serialization;
mod sharing;
mod spotify;
mod spotify_api;
mod spotify_url;
mod spotify_worker;
mod theme;
mod traits;
mod ui;
mod utils;
#[cfg(unix)]
mod ipc;
#[cfg(feature = "mpris")]
mod mpris;
fn main() -> Result<(), String> {
// Set a custom backtrace hook that writes the backtrace to a file instead of stdout, since
// 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");
}
// Set the configuration base path. All configuration files are read/written relative to this
// path.
set_configuration_base_path(matches.get_one::<PathBuf>("basepath").cloned());
match matches.subcommand() {
Some(("info", _subcommand_matches)) => cli::info(),
Some((_, _)) => unreachable!(),
None => {
// Create the application.
let mut application = Application::new(matches.get_one::<String>("config").cloned())?;
// Start the application event loop.
application.run()
}
}
}