@@ -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