aboutsummaryrefslogtreecommitdiff
path: root/src/cli.rs
diff options
context:
space:
mode:
authorTimothy DeHerrera2021-07-15 10:44:40 -0600
committerTimothy DeHerrera2021-07-29 18:17:53 -0600
commit8a27483dce6490eae77b5064a632a91b68c2d10c (patch)
treec49e5fbcdb7f207451b0bfefa903e9b8997a88f2 /src/cli.rs
parent3b6e84d3e274606432876b97b586d06771a3216f (diff)
optionally take args as input
Diffstat (limited to '')
-rw-r--r--src/cli.rs9
1 files changed, 6 insertions, 3 deletions
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,