blob: b701588a03a78e3e5854d7e176459d9b337d8626 (
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
39
40
|
// file : tests/combined/driver.cxx
// author : Boris Kolpackov <boris@codesynthesis.com>
// copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC
// license : MIT; see accompanying LICENSE file
// Test combined flags (-xyz vs -x -y -z) and option values (--foo=bar).
//
#include <iostream>
#include "test.hxx"
using namespace std;
int
main (int argc, char* argv[])
{
try
{
cli::argv_file_scanner s (argc, argv, "--file");
options o (s);
if (o.foo_specified ())
cout << "--foo=" << o.foo () << endl;
if (o.x () || o.y () || o.z ())
cout << '-'
<< (o.x () ? "x" : "")
<< (o.y () ? "y" : "")
<< (o.z () ? "z" : "") << endl;
if (o.xyz ())
cout << "--xyz" << endl;
}
catch (const cli::exception& e)
{
cerr << e << endl;
return 1;
}
}
|