Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@ use tokio::process::Command;
#[command(version = "1.0", author = "Serokell <https://serokell.io/>")]
pub struct Opts {
/// The flake to deploy
#[arg(group = "deploy")]
target: Option<String>,

/// A list of flakes to deploy alternatively
#[arg(long, group = "deploy")]
#[arg(long)]
targets: Option<Vec<String>>,
/// Treat targets as files instead of flakes
#[clap(short, long)]
#[arg(short, long)]
file: Option<String>,
/// Check signatures when using `nix copy`
#[arg(short, long)]
Expand Down Expand Up @@ -677,10 +676,19 @@ pub async fn run(args: Option<&ArgMatches>) -> Result<(), RunError> {
error!("Cannot use both --dry-activate & --boot!");
}

let deploys = opts
.clone()
.targets
.unwrap_or_else(|| vec![opts.clone().target.unwrap_or_else(|| ".".to_string())]);
let deploys = match opts.targets.is_some() && opts.target.is_some() {
true => {
let mut targets = opts.targets.unwrap();
targets.push(opts.target.unwrap());
targets
}
false => opts
.clone()
.targets
.unwrap_or_else(|| vec![opts.clone().target.unwrap_or_else(|| ".".to_string())]),
};

debug!("Deploying the following configurations {:?}", deploys);

let deploy_flakes: Vec<DeployFlake> =
if let Some(file) = &opts.file {
Expand Down