-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmd.h
77 lines (52 loc) · 2.05 KB
/
cmd.h
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef _CMD_H
#define _CMD_H
#undef COMMAND_LIST
#define COMMAND_LIST(args...)
#define PROGRAM(n, v, s, l, u)
#define OPTION(t, v, s, l, d, m, i, dep) \
OPTION_LIMIT(t, v, s, l, d, m, i, (t)~0, dep)
#define OPT_FMT() \
OPTION(FMT, format, 'o', "output-format", "Output format: normal|json|binary|hex", "FMT", NORMAL, false)
#define OPT_INC(v, s, l, d) \
OPTION(INC, v, s, l, d, "INC", 0, false)
#define OPT_VERBOSE() \
OPT_INC(verbose, 'v', "verbose", "Be more verbose")
#define OPT_FLAG(v, s, l, d) \
OPTION(FLAG, v, s, l, d, "FLAG", false, false)
#define OPT_U8_LIMIT(v, s, l, d, limit) \
OPTION_LIMIT(U8, v, s, l, d, "NUM", 0, limit, false)
#define OPT_U8(v, s, l, d) \
OPTION(U8, v, s, l, d, "NUM", 0, false)
#define OPT_U16(v, s, l, d) \
OPTION(U16, v, s, l, d, "NUM", 0, false)
#define OPT_U32(v, s, l, d) \
OPTION(U32, v, s, l, d, "NUM", 0, false)
#define OPT_U32_INIT(v, s, l, d, i) \
OPTION(U32, v, s, l, d, "NUM", i, false)
#define OPT_U64(v, s, l, d) \
OPTION(U64, v, s, l, d, "NUM", 0, false)
#define OPT_U8_LIST(v, s, l, d) \
OPTION(U8_LIST, v, s, l, d, "LIST", NULL, false)
#define OPT_U16_LIST(v, s, l, d) \
OPTION(U16_LIST, v, s, l, d, "LIST", NULL, false)
#define OPT_U32_LIST(v, s, l, d) \
OPTION(U32_LIST, v, s, l, d, "LIST", NULL, false)
#define OPT_U64_LIST(v, s, l, d) \
OPTION(U64_LIST, v, s, l, d, "LIST", NULL, false)
#define OPT_STRING(v, s, l, d) \
OPTION(STRING, v, s, l, d, "STRING", NULL, false)
#define OPT_FILE_A(v, s, l, d) \
OPTION_LIMIT(FILE_A, v, s, l, d, "FILE", NULL, 0, false)
#define OPT_FILE_R(v, s, l, d) \
OPTION_LIMIT(FILE_R, v, s, l, d, "FILE", NULL, 0, false)
#define OPT_FILE_W(v, s, l, d) \
OPTION_LIMIT(FILE_W, v, s, l, d, "FILE", NULL, 0, false)
#define OPT_FILE_AP(v, s, l, d) \
OPTION_LIMIT(FILE_AP, v, s, l, d, "FILE", NULL, 0, false)
#define OPT_FILE_RP(v, s, l, d) \
OPTION_LIMIT(FILE_RP, v, s, l, d, "FILE", NULL, 0, false)
#define OPT_FILE_WP(v, s, l, d) \
OPTION_LIMIT(FILE_WP, v, s, l, d, "FILE", NULL, 0, false)
#define OPT_NS() \
OPT_U32(namespace_id, 'n', "namespace-id", "Namespace Identifier")
#endif