always require args

This commit is contained in:
Kasper Juul Hermansen 2022-11-27 12:42:42 +01:00
parent bb51770505
commit 261de11e76
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912
2 changed files with 10 additions and 4 deletions

View File

@ -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")

View File

@ -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(