diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2022-12-12 18:35:08 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2022-12-12 18:38:12 +0300 |
commit | 8cc86445437e7afc583dee18b36c0e8ba4b6fe12 (patch) | |
tree | 2215464b2434c5e34d748bb08f58b39a34aefd6e /libbutl/b.cxx | |
parent | 82982e037dea53b334070699471e682fb023dc9e (diff) |
Add support for omitting sub-projects from b_info() result
Diffstat (limited to 'libbutl/b.cxx')
-rw-r--r-- | libbutl/b.cxx | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/libbutl/b.cxx b/libbutl/b.cxx index ee5c8a5..3d78803 100644 --- a/libbutl/b.cxx +++ b/libbutl/b.cxx @@ -35,7 +35,7 @@ namespace butl void b_info (std::vector<b_project_info>& r, const vector<dir_path>& projects, - bool ext_mods, + b_info_flags fl, uint16_t verb, const function<b_callback>& cmd_callback, const path& program, @@ -81,13 +81,20 @@ namespace butl else vops.push_back ("-q"); - vector<string> ps; - ps.reserve (projects.size ()); + string spec ("info("); - // Note that quoting is essential here. - // - for (const dir_path& p: projects) - ps.push_back ('\'' + p.representation () + '\''); + for (size_t i (0); i != projects.size(); ++i) + { + if (i != 0) + spec += ' '; + + spec += '\'' + projects[i].representation () + '\''; + } + + if ((fl & b_info_flags::subprojects) == b_info_flags::none) + spec += ",no_subprojects"; + + spec += ')'; pr = process_start_callback ( cmd_callback ? cmd_callback : [] (const char* const*, size_t) {}, @@ -96,10 +103,12 @@ namespace butl 2 /* stderr */, pp, vops, - ext_mods ? nullptr : "--no-external-modules", + ((fl & b_info_flags::ext_mods) == b_info_flags::none + ? "--no-external-modules" + : nullptr), "-s", ops, - "info:", ps); + spec); pipe.out.close (); ifdstream is (move (pipe.in), fdstream_mode::skip, ifdstream::badbit); |