@@ -31,6 +31,7 @@ Commands:\n\
3131 list devices Print list of available device names\n \
3232 list environment Print list of environment configurations\n \
3333 list examples Print list of examples\n \
34+ list templates Print list of templates\n \
3435 list generators Print list of code generators of a given context\n \
3536 list layers Print list of available, referenced and compatible layers\n \
3637 list packs Print list of used packs from the pack repository\n \
@@ -183,6 +184,7 @@ int ProjMgr::ParseCommandLine(int argc, char** argv) {
183184 {" list components" , { true , {context, contextSet, activeTargetSet, debug, filter, load, quiet, schemaCheck, toolchain, verbose}}},
184185 {" list dependencies" , { false , {context, contextSet, activeTargetSet, debug, filter, load, quiet, schemaCheck, toolchain, verbose}}},
185186 {" list examples" , { false , {context, contextSet, activeTargetSet, debug, filter, load, quiet, schemaCheck, toolchain, verbose}}},
187+ {" list templates" , { false , {context, contextSet, activeTargetSet, debug, filter, load, quiet, schemaCheck, toolchain, verbose}}},
186188 {" list contexts" , { false , {debug, filter, quiet, schemaCheck, verbose, ymlOrder}}},
187189 {" list target-sets" , { false , {debug, filter, quiet, schemaCheck, verbose}}},
188190 {" list generators" , { false , {context, contextSet, activeTargetSet, debug, load, quiet, schemaCheck, toolchain, verbose}}},
@@ -376,6 +378,10 @@ int ProjMgr::ProcessCommands() {
376378 if (!RunListExamples ()) {
377379 return ErrorCode::ERROR ;
378380 }
381+ } else if (m_args == " templates" ) {
382+ if (!RunListTemplates ()) {
383+ return ErrorCode::ERROR ;
384+ }
379385 } else if (m_args == " contexts" ) {
380386 if (!RunListContexts ()) {
381387 return ErrorCode::ERROR ;
@@ -938,6 +944,31 @@ bool ProjMgr::RunListExamples(void) {
938944 return true ;
939945}
940946
947+ bool ProjMgr::RunListTemplates (void ) {
948+ if (!m_csolutionFile.empty ()) {
949+ // Parse all input files and create contexts
950+ if (!PopulateContexts ()) {
951+ return false ;
952+ }
953+ }
954+
955+ // Parse context selection
956+ if (!ParseAndValidateContexts ()) {
957+ return false ;
958+ }
959+
960+ vector<string> csolutionTemplates;
961+ if (!m_worker.ListTemplates (csolutionTemplates, m_filter)) {
962+ ProjMgrLogger::Get ().Error (" processing templates list failed" );
963+ return false ;
964+ }
965+
966+ for (const auto & csolutionTemplate : csolutionTemplates) {
967+ ProjMgrLogger::out () << csolutionTemplate << endl;
968+ }
969+ return true ;
970+ }
971+
941972bool ProjMgr::RunListContexts (void ) {
942973 // Parse all input files and create contexts
943974 if (!PopulateContexts ()) {
0 commit comments