Make sure that we can also specify the no-analytics flags with a boolean

This commit is contained in:
Clément Renault 2021-12-08 11:23:16 +01:00
parent 9906db9e64
commit 8c9e51e94f
No known key found for this signature in database
GPG key ID: 92ADA4E935E71FA4
2 changed files with 15 additions and 5 deletions

View file

@ -50,7 +50,7 @@ async fn main() -> anyhow::Result<()> {
let auth_controller = AuthController::new(&opt.db_path, &opt.master_key)?;
#[cfg(all(not(debug_assertions), feature = "analytics"))]
let (analytics, user) = if !opt.no_analytics {
let (analytics, user) = if opt.analytics() {
analytics::SegmentAnalytics::new(&opt, &meilisearch).await
} else {
analytics::MockAnalytics::new(&opt)
@ -125,9 +125,7 @@ pub fn print_launch_resume(opt: &Opt, user: &str) {
#[cfg(all(not(debug_assertions), feature = "analytics"))]
{
if opt.no_analytics {
eprintln!("Anonymous telemetry:\t\"Disabled\"");
} else {
if opt.analytics() {
eprintln!(
"
Thank you for using MeiliSearch!
@ -136,6 +134,8 @@ We collect anonymized analytics to improve our product and your experience. To l
Anonymous telemetry:\t\"Enabled\""
);
} else {
eprintln!("Anonymous telemetry:\t\"Disabled\"");
}
}