blob: 77b9a8d7b17c732cd929f7fe22e0d59ce2b920b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
// file : position/driver.cxx
// author : Boris Kolpackov <boris@codesynthesis.com>
// license : MIT; see accompanying LICENSE file
// Test argument/option position.
//
#include <iostream>
#include "test.hxx"
using namespace std;
int
main (int argc, char* argv[])
{
try
{
cli::argv_file_scanner scan (argc, argv, "--file");
options ops (scan);
if (ops.a_specified ())
cout << ops.a ().second << ": " << "-a " << ops.a ().first << endl;
for (const pair<int, size_t>& b: ops.b ())
{
cout << b.second << ": " << "-b " << b.first << endl;
}
while (scan.more ())
cout << scan.position () << ": " << scan.next () << endl;
cout << "max: " << scan.position () << endl;
}
catch (const cli::exception& e)
{
cerr << e << endl;
}
}
|