Skip to content

Commit

Permalink
attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
morgante committed Jan 3, 2025
1 parent 78b877c commit 70e883c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
27 changes: 27 additions & 0 deletions crates/cli/src/commands/apply_migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ pub struct ApplyMigrationArgs {
/// Print verbose output
#[clap(long)]
pub(crate) verbose: bool,
// Capture remaining arguments
#[arg(trailing_var_arg = true, allow_hyphen_values = true, index = 2)]
pub(crate) inputs: Vec<String>,
}

impl ApplyMigrationArgs {
Expand Down Expand Up @@ -104,3 +107,27 @@ pub(crate) async fn run_apply_migration(

Ok(workflow_status.clone())
}

#[cfg(test)]
mod tests {
use super::*;
use anyhow::Result;
use clap::{Arg, ArgAction, Command, FromArgMatches};

#[test]
fn test_arg_parsing() -> Result<()> {
let args = ApplyMigrationArgs::augment_args(Command::new("test"));

let matches =
args.get_matches_from(vec!["test", "--watch", "--test", "bob", "--suzy=queue"]);

let apply_args = ApplyMigrationArgs::from_arg_matches(&matches)?;

println!("{:?}", apply_args);

// assert_eq!(payload.get("test").unwrap().as_str().unwrap(), "bob");
// assert_eq!(payload.get("suzy").unwrap().as_str().unwrap(), "queue");

Ok(())
}
}
1 change: 1 addition & 0 deletions crates/cli/src/commands/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ pub(crate) async fn run_plumbing(
workflow_id: None,
verbose: true,
watch: false,
inputs: vec![],
},
emitter,
execution_id.clone(),
Expand Down

0 comments on commit 70e883c

Please sign in to comment.