use arguments::{Arguments, Commands}; use clap::Parser; use commands::{add, print, remove}; use shared::{directories, errors::Error}; use std::path::Path; mod arguments; mod commands; mod logging; fn main() -> Result<(), Error> { logging::initialize_logger()?; let default_path = directories::get_names_path()?; let args = Arguments::parse(); let separator = args.separator.unwrap_or(": ".into()); let path = match &args.path { Some(path) => Path::new(path), None => &default_path, }; match &args.command { Commands::Print { filter, group, json, } => print(path, filter, group, &separator, *json)?, Commands::Add { url, name } => add(path, url, name, &separator)?, Commands::Remove { url } => remove(path, url, &separator)?, }; Ok(()) }