Improve README.
[command.git] / README
1 # Command
2
3 C++ library for handling command line arguments, designed to be easily used.
4
5 ## Installation
6 1. $ ./autogen.sh
7 2. $ ./configure
8 3. $ make
9 4. $ sudo make install
10
11 ## Configuration
12
13 You need to enable c++11 support in your compiler. You can achieve that in
14 g++ and clang++ by adding `-std=c++11` compilation flag.
15
16 As this is header-only library, you don't need any additional steps.
17
18 ## Usage
19
20 example.cpp:
21
22     #include <iostream>
23     #include <command/command.h>
24     #include <command/option.h>
25
26     using namespace command;
27
28     int main(int argc, char *argv[]) {
29         try {
30             Command command(argc, argv, {
31                 new Option<void>("-h", "Help", [](void) { std::cout << "Help information\n"; })
32             });
33         }
34         catch(const std::exception & e) {
35             return 1;
36         }
37
38         return 0;
39     }
40
41 Now program can be compiled & run using following commands:
42
43     $ g++ -std=c++11 example.cpp
44     $ ./a.out -h
45     Help information