From 7d9fac6ae05ca516f8a2b058a94d156daad6982a Mon Sep 17 00:00:00 2001 From: q66 Date: Thu, 29 Oct 2015 17:34:33 +0000 Subject: [PATCH] add invoke command to exec a rule/action and wait for it --- example/obuild.cfg | 4 ++++ main.cc | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/example/obuild.cfg b/example/obuild.cfg index c6579a5..c691451 100644 --- a/example/obuild.cfg +++ b/example/obuild.cfg @@ -28,6 +28,10 @@ action info [ echo "number of jobs:" $numjobs ] +action test_invoke [ + invoke test +] + // dependencies rule foo.o foo.h diff --git a/main.cc b/main.cc index 196bcbd..f4d3ace 100644 --- a/main.cc +++ b/main.cc @@ -456,6 +456,10 @@ int main(int argc, char **argv) { cs.result->set_str_dup(ret); }); + os.cs.add_command("invoke", "s", [](CsState &cs, const char *name) { + cs.result->set_int(((ObState &)cs).exec_main(name)); + }); + cs_register_globs(os.cs); if ((!fcont.empty() && !os.cs.run_bool(fcont)) || !os.cs.run_file(fname))