diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-11-16 11:43:19 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-11-16 11:43:19 +0200 |
commit | 5a2da5767e796bcfdaf5ebf3b80b93c57d31d0aa (patch) | |
tree | e3f101a7cae07ce18a485abc261b15467339861b /cli/cli.cxx | |
parent | 03ee21e34a4829644cc07b4fc6378b2f5e1de937 (diff) |
Support specifying documentation variables on command linedoc
Diffstat (limited to 'cli/cli.cxx')
-rw-r--r-- | cli/cli.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
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 <cutl/compiler/code-stream.hxx> +#include <semantics/doc.hxx> + #include "options.hxx" #include "parser.hxx" #include "generator.hxx" @@ -97,6 +99,24 @@ main (int argc, char* argv[]) parser p (include_paths); auto_ptr<semantics::cli_unit> unit (p.parse (ifs, path)); + // Merge documentation variables from the command line. + // + for (map<string, string>::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<doc> ("", "var: " + i->first) != 0) + continue; + + doc& d (unit->new_node<doc> (semantics::path ("<command line>"), 0, 0)); + unit->new_edge<semantics::names> (*unit, d, "var: " + i->first); + d.push_back (i->second); + } + generator g; g.generate (ops, *unit, path); } |