From 261de11e763bbce6a5f355e47f9f8acc0f2c0409 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sun, 27 Nov 2022 12:42:42 +0100 Subject: [PATCH] always require args --- crates/octopush_cli/src/commands/execute.rs | 6 +++--- src/main.rs | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/crates/octopush_cli/src/commands/execute.rs b/crates/octopush_cli/src/commands/execute.rs index 737fe07..35c16e8 100644 --- a/crates/octopush_cli/src/commands/execute.rs +++ b/crates/octopush_cli/src/commands/execute.rs @@ -28,21 +28,21 @@ pub fn execute_cmd() -> Command { .long("gitea-api-token") .action(ArgAction::Set) .env("GITEA_API_TOKEN") - .required(false), + .required(true), ) .arg( Arg::new("gitea-username") .long("gitea-username") .action(ArgAction::Set) .env("GITEA_USERNAME") - .required(false), + .required(true), ) .arg( Arg::new("gitea-url") .long("gitea-url") .action(ArgAction::Set) .env("GITEA_URL") - .required(false), + .required(true), ) .arg( Arg::new("github-api-token") diff --git a/src/main.rs b/src/main.rs index 4dfd6b2..e52068d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,9 +1,15 @@ use dotenv::dotenv; +use eyre::Context; use tracing_subscriber::prelude::*; #[tokio::main] async fn main() -> eyre::Result<()> { - dotenv()?; + if let Err(e) = dotenv().context(".env file not found") { + tracing::info!( + error = e.to_string(), + "no .env file specified, command args are required" + ); + } tracing_subscriber::registry() .with(tracing_subscriber::EnvFilter::new(