Skip to content

Commit

Permalink
Pass ext str vec to command
Browse files Browse the repository at this point in the history
  • Loading branch information
riseshia committed Jun 22, 2024
1 parent 0b34f3e commit 038b08d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
8 changes: 5 additions & 3 deletions src/commands/apply.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
use std::process::exit;

use crate::cli::StrKeyVal;

use super::plan::PlanCommand;

pub struct ApplyCommand;

impl ApplyCommand {
pub fn run(force: &bool, config: &str) {
pub fn run(force: &bool, config: &str, ext_str: &Vec<StrKeyVal>) {
if !force {
PlanCommand::run(config);
PlanCommand::run(config, ext_str);

print!(
r#"
Expand All @@ -25,6 +27,6 @@ Enter a value: "#
}
}

println!("apply called with {}!", config);
println!("apply called with {}, {:?}!", config, ext_str)
}
}
6 changes: 4 additions & 2 deletions src/commands/plan.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
use crate::cli::StrKeyVal;

pub struct PlanCommand;

impl PlanCommand {
pub fn run(config: &str) {
pub fn run(config: &str, ext_str: &Vec<StrKeyVal>) {
// read config
// fetch resource from aws api
// diff
// emit changed resource based on diff
println!("plan called with {}!", config)
println!("plan called with {}, {:?}!", config, ext_str)
}
}
6 changes: 2 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ fn main() {

match &cli.command {
Commands::Apply { force, config, ext_str } => {
println!("{:?}", ext_str);
ApplyCommand::run(force, config);
ApplyCommand::run(force, config, ext_str);
}
Commands::Plan { config, ext_str } => {
println!("{:?}", ext_str);
PlanCommand::run(config);
PlanCommand::run(config, ext_str);
}
}
}

0 comments on commit 038b08d

Please sign in to comment.