Skip to content

Commit 2d6a231

Browse files
committed
feat(tui): allow to setup variables for each pipeline independently
1 parent 1061273 commit 2d6a231

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "deployer"
3-
version = "2.0.0-beta-7"
3+
version = "2.0.0-beta-8"
44
edition = "2024"
55

66
[[bin]]

TODO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@
3333
- [ ] Fix issue which causes not to adding actions definitions when using a pipeline from the registry, to the project config
3434
- [x] Add `info` field to requirements to inform users about commands or links to install them
3535
- [x] Unify `edit`, `cat` & `rm` commands behavior
36-
- [ ] Add possibility to setup variables inside each pipeline independently
36+
- [x] Add possibility to setup variables inside each pipeline independently
3737
- [x] Add `use` command to synchronize content (with `subfolder` argument)

src/tui/edit.rs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,10 @@ impl DescribedPipeline {
542542
// }
543543
actions.extend_from_slice(&["Edit pipeline title", "Edit pipeline description", "Edit pipeline tags"]);
544544
if !in_registry && variables.is_some() {
545-
actions.push("Export pipeline to the global registry");
545+
actions.extend_from_slice(&[
546+
"Export pipeline to the global registry",
547+
"Setup variables for the pipeline",
548+
]);
546549
}
547550

548551
while let Some(action) = inquire_reorder::Select::new(
@@ -618,6 +621,31 @@ impl DescribedPipeline {
618621
pipelines_registry.insert(self.clone());
619622
println!("{}", i18n::PIPELINE_EXPORTED);
620623
}
624+
"Setup variables for the pipeline" => {
625+
let variables = variables.unwrap();
626+
if variables.is_empty() {
627+
println!("Please, specify variables for project first!");
628+
let mut needed = vec![];
629+
for action in &self.actions {
630+
let definition = action.definition(project_actions)?;
631+
for var in definition.collect_required_variables() {
632+
needed.push(format!(
633+
"\t- variable `{var}` for pipeline `{}`, action `{}`",
634+
self.info.to_str(),
635+
action.used.to_str()
636+
));
637+
}
638+
}
639+
println!("These variables are required:");
640+
needed.iter().for_each(|v| println!("{v}"));
641+
continue;
642+
}
643+
for action in &mut self.actions {
644+
if let Ok(setup) = action.prompt_setup_for_project(variables, project_actions) {
645+
*action = setup;
646+
}
647+
}
648+
}
621649
_ => {}
622650
}
623651
}

0 commit comments

Comments
 (0)