FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
docopt.cpp/run_testcase.cpp at master · siliconvoodoo/docopt.cpp · GitHub
siliconvoodoo
/
docopt.cpp
Public
forked from
docopt/docopt.cpp
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
docopt.cpp
/
run_testcase.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
40 lines (32 loc) · 751 Bytes
Breadcrumbs
docopt.cpp
/
run_testcase.cpp
Copy path
File metadata and controls
40 lines (32 loc) · 751 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
//
//
docopt_tests.cpp
//
docopt
//
//
Created by Jared Grubb on 2013-11-03.
//
Copyright (c) 2013 Jared Grubb. All rights reserved.
//
#
include
"
docopt.h
"
#
include
<
iostream
>
int
main
(
int
argc,
const
char
** argv)
{
if
(argc <
2
) {
std::cerr <<
"
Usage: docopt_tests USAGE [arg]...
"
<< std::endl;
exit
(-
5
);
}
std::string usage = argv[
1
];
std::vector<std::string> args {argv+
2
, argv+argc};
auto
result =
docopt::docopt
(usage, args);
//
print it out in JSON form
std::cout <<
"
{
"
;
bool
first =
true
;
for
(
auto
const
& arg : result) {
if
(first) {
first =
false
;
}
else
{
std::cout <<
"
,
"
<< std::endl;
}
std::cout <<
'
"
'
<< arg.
first
<<
'
"
'
<<
"
:
"
<< arg.
second
;
}
std::cout <<
"
}
"
<< std::endl;
return
0
;
}
Back
|
FazBrowse Home
|
New Git URL