From cc62c09409021582d8b5ffe3b5c9d393524fd260 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 11 Oct 2009 15:45:06 +0200 Subject: Add usage information --- cli/cli.cxx | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'cli/cli.cxx') 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 #include +#include + +#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 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 -- cgit v1.1