forked from docopt/docopt.c
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample.c
30 lines (28 loc) · 1.28 KB
/
example.c
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
#include "docopt.c"
int main(int argc, char *argv[])
{
DocoptArgs args = docopt(--argc, ++argv, /* help */ 1, /* version */ "2.0rc2");
printf("Commands\n");
printf(" mine == %s\n", args.mine ? "true" : "false");
printf(" move == %s\n", args.move ? "true" : "false");
printf(" create == %s\n", args.create ? "true" : "false");
printf(" remove == %s\n", args.remove ? "true" : "false");
printf(" set == %s\n", args.set ? "true" : "false");
printf(" ship == %s\n", args.ship ? "true" : "false");
printf(" shoot == %s\n", args.shoot ? "true" : "false");
printf(" anchor == %s\n", args.anchor ? "true" : "false");
printf("Arguments\n");
printf(" name == %s\n", args.name);
printf(" x == %s\n", args.x);
printf(" y == %s\n", args.y);
printf(" number == %s\n", args.number);
printf("Flags\n");
printf(" --drifting == %s\n", args.drifting ? "true" : "false");
printf(" --help == %s\n", args.help ? "true" : "false");
printf(" --moored == %s\n", args.moored ? "true" : "false");
printf(" --up == %s\n", args.up ? "true" : "false");
printf(" --version == %s\n", args.version ? "true" : "false");
printf("Options\n");
printf(" --speed == %s\n", args.speed);
return 0;
}