From: Rafał Długołęcki Date: Wed, 20 May 2015 18:58:59 +0000 (+0200) Subject: Add simple example and improve README file. X-Git-Tag: v0.2.1~4 X-Git-Url: https://git.dlugolecki.net.pl/?a=commitdiff_plain;h=774cf593d2dafc996cc643e68ae19882839ee888;p=command.git Add simple example and improve README file. --- diff --git a/README b/README index 6166838..037aea0 100644 --- a/README +++ b/README @@ -3,10 +3,11 @@ C++ library for handling command line arguments, designed to be easily used. ## Installation -1. $ ./autogen.sh -2. $ ./configure -3. $ make -4. $ sudo make install + + $ ./autogen.sh + $ ./configure + $ make + $ sudo make install ## Configuration @@ -43,3 +44,11 @@ Now program can be compiled & run using following commands: $ g++ -std=c++11 example.cpp $ ./a.out -h Help information + +## Documentation + +Current documentation can be found at: +http://dlugolecki.net.pl/software/command/docs/ + +If for some reason it is unavailable, you can build it yourself. The only +requirement is to have [Doxygen](www.doxygen.org/) installed when `make` command is invoked. diff --git a/docs/examples/basic/example.cpp b/docs/examples/basic/example.cpp new file mode 100644 index 0000000..71e3e20 --- /dev/null +++ b/docs/examples/basic/example.cpp @@ -0,0 +1,27 @@ +#include +#include +#include + +using namespace command; + +/** + * Just a simple example allowing to display help information if user will set + * command line option: -h, e.g.: + * + * ./a.out -h + * + */ +int main(int argc, char *argv[]) { + try { + Command command(argc, argv, { + new Option("-h", "Help", [](void) { + std::cout << "Help information\n"; + }) + }); + } + catch(const std::exception & e) { + return 1; + } + + return 0; +}