aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/deploy.rs2
-rw-r--r--src/cli.rs9
2 files changed, 7 insertions, 4 deletions
diff --git a/src/bin/deploy.rs b/src/bin/deploy.rs
index 6686258..e924dc9 100644
--- a/src/bin/deploy.rs
+++ b/src/bin/deploy.rs
@@ -8,7 +8,7 @@ use log::error;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
- match cli::run().await {
+ match cli::run(None).await {
Ok(()) => (),
Err(err) => {
error!("{}", err);
diff --git a/src/cli.rs b/src/cli.rs
index 2fdaaec..9214ebd 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -6,7 +6,7 @@
use std::collections::HashMap;
use std::io::{stdin, stdout, Write};
-use clap::Clap;
+use clap::{Clap, ArgMatches, FromArgMatches};
use crate as deploy;
@@ -607,8 +607,11 @@ pub enum RunError {
RunDeploy(#[from] RunDeployError),
}
-pub async fn run() -> Result<(), RunError> {
- let opts: Opts = Opts::parse();
+pub async fn run(args: Option<&ArgMatches>) -> Result<(), RunError> {
+ let opts = match args {
+ Some(o) => <Opts as FromArgMatches>::from_arg_matches(o),
+ None => Opts::parse(),
+ };
deploy::init_logger(
opts.debug_logs,