Improve installation info.
[command.git] / README
1 # Command
2
3 C++ library for handling command line arguments.
4
5 ## Installation
6
7 ### debian package
8
9     $ wget https://github.com/quayle/command/releases/download/v0.2.1-deb/command_0.2.1_all.deb
10     $ sudo dpkg -i command_0.2.1_all.deb
11
12 ### from sources
13
14 You will need to have autotools installed (automake, autoconf, ...)
15
16     $ ./autogen.sh
17     $ ./configure
18     $ make
19     $ sudo make install
20
21 ## Configuration
22
23 You need to enable c++11 support in your compiler. You can achieve that in
24 g++ and clang++ by adding `-std=c++11` compilation flag.
25
26 As this is header-only library, you don't need any additional steps.
27
28 ## Usage
29
30 example.cpp:
31
32     #include <iostream>
33     #include <command/command.h>
34     #include <command/option.h>
35
36     using namespace command;
37
38     int main(int argc, char *argv[]) {
39         try {
40             Command command(argc, argv, {
41                 new Option<void>("-h", "Help", [](void) { std::cout << "Help information\n"; })
42             });
43         }
44         catch(const std::exception & e) {
45             return 1;
46         }
47
48         return 0;
49     }
50
51 Now program can be compiled & run using following commands:
52
53     $ g++ -std=c++11 example.cpp
54     $ ./a.out -h
55     Help information
56
57 ## Documentation
58
59 Current documentation can be found at:
60 http://dlugolecki.net.pl/software/command/docs/
61
62 If for some reason it is unavailable, you can build it yourself. The only
63 requirement is to have [Doxygen](http://www.doxygen.org/) installed when `make` command is invoked.