From 5a2da5767e796bcfdaf5ebf3b80b93c57d31d0aa Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 16 Nov 2015 11:43:19 +0200 Subject: Support specifying documentation variables on command line --- cli/cli.cxx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'cli/cli.cxx') diff --git a/cli/cli.cxx b/cli/cli.cxx index 41f90aa..ecf3b3b 100644 --- a/cli/cli.cxx +++ b/cli/cli.cxx @@ -11,6 +11,8 @@ #include +#include + #include "options.hxx" #include "parser.hxx" #include "generator.hxx" @@ -97,6 +99,24 @@ main (int argc, char* argv[]) parser p (include_paths); auto_ptr unit (p.parse (ifs, path)); + // Merge documentation variables from the command line. + // + for (map::const_iterator i (ops.docvar ().begin ()); + i != ops.docvar ().end (); + ++i) + { + using semantics::doc; + + // Values specified in the .cli file override command line. + // + if (unit->lookup ("", "var: " + i->first) != 0) + continue; + + doc& d (unit->new_node (semantics::path (""), 0, 0)); + unit->new_edge (*unit, d, "var: " + i->first); + d.push_back (i->second); + } + generator g; g.generate (ops, *unit, path); } -- cgit v1.1