diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2009-10-11 15:45:06 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2009-10-11 15:45:06 +0200 |
commit | cc62c09409021582d8b5ffe3b5c9d393524fd260 (patch) | |
tree | 67455202970e8ec4520f5c06e31c5a28a5180f33 /cli/cli.cxx | |
parent | e228bb3ed878e071618b0f31856770c60cdf48df (diff) |
Add usage information
Diffstat (limited to 'cli/cli.cxx')
-rw-r--r-- | cli/cli.cxx | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/cli/cli.cxx b/cli/cli.cxx index 4aaa2d6..b2c6695 100644 --- a/cli/cli.cxx +++ b/cli/cli.cxx @@ -7,11 +7,15 @@ #include <fstream> #include <iostream> +#include <cutl/compiler/code-stream.hxx> + +#include "usage.hxx" #include "options.hxx" #include "parser.hxx" #include "generator.hxx" using namespace std; +using namespace cutl; int main (int argc, char* argv[]) { @@ -22,6 +26,8 @@ int main (int argc, char* argv[]) int end; options ops (argc, argv, end); + // Handle --version + // if (ops.version ()) { e << "CodeSynthesis CLI command line interface compiler 0.0.2" << endl @@ -34,6 +40,29 @@ int main (int argc, char* argv[]) return 0; } + // Handle --help + // + if (ops.help ()) + { + e << "Usage: " << argv[0] << " [options] file" + << endl + << "Options:" << endl; + + compiler::ostream_filter<usage_indenter, char> filt (e); + + e << "--help" << endl + << " Print usage information and exit." + << endl; + + e << "--version" << endl + << " Print version and exit." + << endl; + + generator::usage (); + + return 0; + } + if (end == argc) { e << "error: no input file specified" << endl |