From a15cf65c44d5c224169c32ef5495b68c758134b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 18 May 2014 16:08:14 +0200 Subject: Imported Upstream version 3.3.0.2 --- libcult/documentation/cli/index.xhtml | 106 ++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 libcult/documentation/cli/index.xhtml (limited to 'libcult/documentation/cli/index.xhtml') diff --git a/libcult/documentation/cli/index.xhtml b/libcult/documentation/cli/index.xhtml new file mode 100644 index 0000000..9c3f1a8 --- /dev/null +++ b/libcult/documentation/cli/index.xhtml @@ -0,0 +1,106 @@ + + + + + + + + + libcult/documentation/cli + + + + + + + + + + + + + + +
+

The libcult command line interace library provides +mechanisms for extracting informtaion from the command line. The +following code fragment is from libcult/examples/cli:

+ +
+namespace
+{
+  extern Char const help[] = "help";
+  extern Char const version[] = "version";
+  extern Char const outdir[] = "outdir";
+}
+
+typedef
+CLI::Options<help, Boolean,
+             version, Boolean,
+             outdir, String>
+Options;
+
+Int
+main (Int argc, Char* argv[])
+{
+  try
+  {
+    Options options (CLI::parse<Options> (argc, argv));
+
+    if (options.value<help> ())
+    {
+      cerr << "usage: " << argv[0] << " [--help] [--version] [--outdir <dir>]"
+           << endl;
+      return 0;
+    }
+
+    if (options.value<version> ())
+    {
+      cerr << argv[0] << " 1.2.3" << endl;
+      return 0;
+    }
+
+    if (String dir = options.value<outdir> ())
+    {
+      cerr << "outdir: " << dir << endl;
+    }
+  }
+  catch (CLI::UnexpectedOption const& e)
+  {
+    cerr << "unexpected option " << e.option () <<endl;
+  }
+  catch (CLI::OptionFormat const& e)
+  {
+    cerr << "bad format for " << e.option () << endl;
+  }
+}
+
+
+ +
+

Copyright © 2005-2010 Boris Kolpackov.

+ +
+Permission is granted to copy, distribute and/or modify this document under +the terms of the GNU Free +Documentation License, version 1.2; with no Invariant Sections, no +Front-Cover Texts and no Back-Cover Texts. +
+
+ + + -- cgit v1.2.3