From 2a7623dc400d2932b95eab13bced1a5abbdae003 Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Sun, 28 Aug 2022 16:20:46 +0300 Subject: [PATCH] check GENIUS_TOKEN environment variable --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/main.rs | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 149a43a..d058e70 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -286,7 +286,7 @@ dependencies = [ [[package]] name = "genius-cli" -version = "0.1.0" +version = "0.1.1" dependencies = [ "clap", "colored_json", diff --git a/Cargo.toml b/Cargo.toml index 00b5c11..a46989f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "genius-cli" -version = "0.1.0" +version = "0.1.1" edition = "2021" description = "A command-line interface for Genius.com" readme = "README.md" diff --git a/src/main.rs b/src/main.rs index 063a45f..5d31abb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -use std::env; +use std::{env, process::exit}; use clap::{Arg, Command}; use colored_json::ToColoredJson; @@ -54,7 +54,8 @@ fn cli() -> Command<'static> { #[tokio::main] async fn main() { if env::var("GENIUS_TOKEN").unwrap().is_empty() { - panic!("Please set the GENIUS_TOKEN environment variable"); + println!("Please set the GENIUS_TOKEN environment variable"); + exit(1); } let genius = Genius::new(env::var("GENIUS_TOKEN").unwrap()); -- 2.51.2