use std::path::{Path, PathBuf};
use anyhow::Error;
use clap::ValueEnum;
pub mod firefox;
#[derive(Default, Clone, ValueEnum)]
pub enum WebBrowser {
#[default]
Firefox,
}
impl WebBrowser {
pub fn get_profiles_root(&self) -> Result<PathBuf, Error> {
match self {
WebBrowser::Firefox => firefox::get_profiles_root(),
}
}
pub fn create_profile(&self, profile_path: &Path, no_ublock: bool) -> Result<(), Error> {
match self {
WebBrowser::Firefox => firefox::create_profile(profile_path, no_ublock),
}
}
pub fn update_profile(&self, profile_path: &Path) -> Result<(), Error> {
match self {
WebBrowser::Firefox => firefox::update_profile(profile_path),
}
}
pub fn delete_profile(&self, profile_path: &Path) -> Result<(), Error> {
match self {
WebBrowser::Firefox => firefox::delete_profile(profile_path),
}
}
pub fn format_exec_command(
&self,
profile_path: &Path,
url: &str,
icon: &str,
private_window: bool,
custom_params: Option<&str>,
) -> String {
match self {
WebBrowser::Firefox => {
firefox::format_exec_command(profile_path, url, icon, private_window, custom_params)
}
}
}
}