1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
use clap::Subcommand;
// ---
#[derive(Debug, Clone, Subcommand)]
pub enum AnalyticsCommands {
/// Prints extra information about analytics.
Details,
/// Deletes everything related to analytics.
///
/// This will remove all pending data that hasn't yet been sent to our servers, as well as
/// reset your analytics ID.
Clear,
/// Associate an email address with the current user.
Email { email: String },
/// Enable analytics.
Enable,
/// Disable analytics.
Disable,
/// Prints the current configuration.
Config,
}
impl AnalyticsCommands {
pub fn run(&self) -> Result<(), re_analytics::cli::CliError> {
match self {
#[allow(clippy::unit_arg)]
Self::Details => Ok(re_analytics::cli::print_details()),
Self::Clear => re_analytics::cli::clear(),
Self::Email { email } => {
re_analytics::cli::set([("email".to_owned(), email.clone().into())])
}
Self::Enable => re_analytics::cli::opt(true),
Self::Disable => re_analytics::cli::opt(false),
Self::Config => re_analytics::cli::print_config(),
}
}
}