From c16222907ea84936f43f5fdd8500a6a19be993ee Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 11 Oct 2009 14:18:55 +0200 Subject: Add another example, README files, and VC++ projects/solutions --- examples/hello/README | 26 +++++ examples/hello/driver.cxx | 6 +- examples/hello/hello-8.0.vcproj | 237 ++++++++++++++++++++++++++++++++++++++++ examples/hello/hello-9.0.vcproj | 233 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 500 insertions(+), 2 deletions(-) create mode 100644 examples/hello/README create mode 100644 examples/hello/hello-8.0.vcproj create mode 100644 examples/hello/hello-9.0.vcproj (limited to 'examples/hello') diff --git a/examples/hello/README b/examples/hello/README new file mode 100644 index 0000000..a1fe976 --- /dev/null +++ b/examples/hello/README @@ -0,0 +1,26 @@ +This is a "Hello, world!" example that shows how to implement a very basic +command line interface using CLI. + +The example consists of the following files: + +hello.cli + Options class definition in the CLI language. + +hello.hxx +hello.ixx +hello.cxx + Options class implementation in C++. These files are generated by the CLI + compiler from hello.cli using the following command line: + + cli hello.cli + +driver.cxx + Driver for the example. It first instantiates the option class which parses + the command line. The driver then examines the options and prints the + greeting string for each name passed as argument. + +To run the example you can try the following command lines: + +$ ./driver --help +$ ./driver John Jane +$ ./driver --greeting Hi --exclamations 3 John Jane diff --git a/examples/hello/driver.cxx b/examples/hello/driver.cxx index 6641d4b..b08e6be 100644 --- a/examples/hello/driver.cxx +++ b/examples/hello/driver.cxx @@ -14,8 +14,8 @@ usage () { cerr << "usage: driver " << endl << " [--help]" << endl - << " [--greeting|-g ]" << endl - << " [--exclamations|-e ]" << endl; + << " [--greeting ]" << endl + << " [--exclamations ]" << endl; } int @@ -39,6 +39,8 @@ main (int argc, char* argv[]) return 1; } + // Print the greetings. + // for (int i = end; i < argc; i++) { cout << o.greeting () << ", " << argv[i]; diff --git a/examples/hello/hello-8.0.vcproj b/examples/hello/hello-8.0.vcproj new file mode 100644 index 0000000..6415d8c --- /dev/null +++ b/examples/hello/hello-8.0.vcproj @@ -0,0 +1,237 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/hello/hello-9.0.vcproj b/examples/hello/hello-9.0.vcproj new file mode 100644 index 0000000..3ca9838 --- /dev/null +++ b/examples/hello/hello-9.0.vcproj @@ -0,0 +1,233 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.1