summaryrefslogtreecommitdiff
path: root/cli/options.cli
blob: a1cc3b46116d3ba1471375d2d7c1398b1e96fb86 (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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
// file      : cli/options.cli
// author    : Boris Kolpackov <boris@codesynthesis.com>
// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
// license   : MIT; see accompanying LICENSE file

// NOTE: Make sure you have a working CLI compiler around before
// modifying this file.
//

include <map>;
include <string>;
include <vector>;
include <cstddef>;

class options
{
  bool --help {"Print usage information and exit."};
  bool --version {"Print version and exit."};

  std::string --output-dir | -o
  {
    "<dir>",
    "Write the generated files to <dir> instead of the current directory."
  };

  bool --generate-modifier
  {
    "Generate option value modifiers in addition to accessors."
  };

  bool --generate-specifier
  {
    "Generate functions for determining whether the option was specified
     on the command line."
  };

  bool --generate-description
  {
    "Generate the option description list that can be examined at runtime."
  };

  bool --generate-file-scanner
  {
    "Generate the \c{argv_file_scanner} implementation. This scanner is
     capable of reading command line arguments from the \c{argv} array as
     well as files specified with command line options."
  };

  bool --suppress-inline
  {
    "Generate all functions non-inline. By default simple functions are
     made inline. This option suppresses creation of the inline file."
  };

  bool --suppress-undocumented
  {
    "Suppress the generation of documentation entries for undocumented
     options."
  };

  bool --suppress-usage
  {
    "Suppress the generation of the usage printing code."
  };

  bool --long-usage
  {
    "If no short documentation string is provided, use the complete
     long documentation string in usage. By default, in this situation
     only the first sentence from the long string is used."
  };

  std::size_t --option-length = 0
  {
    "<len>",
    "Indent option descriptions <len> characters when printing usage. This is
     useful when you have multiple options classes, potentially in separate
     files, and would like their usage to have the same indentation level."
  };

  std::string --cli-namespace = "::cli"
  {
    "<ns>",
    "Generate the CLI support types in the <ns> namespace (\cb{cli} by
     default). The namespace can be nested, for example \cb{details::cli}.
     If the namespace is empty, then the support types are generated in
     the global namespace."
  };

  bool --generate-cxx
  {
    "Generate C++ code. If neither \cb{--generate-man} nor \cb{--generate-html}
     is specified, this mode is assumed by default."
  };

  bool --generate-man
  {
    "Generate documentation in the man page format."
  };

  bool --generate-html
  {
    "Generate documentation in the HTML format."
  };

  std::string --man-prologue
  {
    "<file>",
    "Insert the content of <file> at the beginning of the man page file."
  };

  std::string --man-epilogue
  {
    "<file>",
    "Insert the content of <file> at the end of the man page file."
  };

  std::string --html-prologue
  {
    "<file>",
    "Insert the content of <file> at the beginning of the HTML file."
  };

  std::string --html-epilogue
  {
    "<file>",
    "Insert the content of <file> at the end of the HTML file."
  };

  std::string --class
  {
    "<fq-name>",
    "Generate the man page or HTML documentation only for the <fq-name> options
     class. The <fq-name> name should be a fully-qualified options class name,
     for example, \cb{app::options}. This functionality is useful if you need
     to insert custom documentation between options belonging to different
     classes."
  };

  bool --stdout
  {
    "Write output to STDOUT instead of a file. This option is not valid
     when generating C++ code and is normally used to combine generated
     documentation for several option classes in a single file."
  };

  std::string --hxx-suffix = ".hxx"
  {
    "<suffix>",
    "Use <suffix> instead of the default \cb{.hxx} to construct the name of
     the generated header file."
  };

  std::string --ixx-suffix = ".ixx"
  {
    "<suffix>",
    "Use <suffix> instead of the default \cb{.ixx} to construct the name of
     the generated inline file."
  };

  std::string --cxx-suffix = ".cxx"
  {
    "<suffix>",
    "Use <suffix> instead of the default \cb{.cxx} to construct the name of
     the generated source file."
  };

  std::string --man-suffix = ".1"
  {
    "<suffix>",
    "Use <suffix> instead of the default \cb{.1} to construct the name of
     the generated man page file."
  };

  std::string --html-suffix = ".html"
  {
    "<suffix>",
    "Use <suffix> instead of the default \cb{.html} to construct the name
     of the generated HTML file."
  };

  std::string --option-prefix = "-"
  {
    "<prefix>",
    "Use <prefix> instead of the default \cb{-} as an option prefix. Unknown
     command line arguments that start with this prefix are treated as unknown
     options. If you set the option prefix to the empty value, then all the
     unknown command line arguments will be treated as program arguments."
  };

  std::string --option-separator = "--"
  {
    "<sep>",
    "Use <sep> instead of the default \cb{--} as an optional separator between
     options and arguments. All the command line arguments that are parsed
     after this separator are treated as program arguments. Set the option
     separator to the empty value if you don't want this functionality."
  };

  bool --include-with-brackets
  {
    "Use angle brackets (<>) instead of quotes (\"\") in the generated
     \cb{#include} directives."
  };

  std::string --include-prefix
  {
    "<prefix>",
    "Add <prefix> to the generated \cb{#include} directive paths."
  };

  std::string --guard-prefix
  {
    "<prefix>",
    "Add <prefix> to the generated header inclusion guards. The prefix is
     transformed to upper case and characters that are illegal in a
     preprocessor macro name are replaced with underscores."
  };

  std::map<std::string, std::string> --reserved-name
  {
    "<name>=<rep>",
    "Add <name> with an optional <rep> replacement to the list of names
     that should not be used as identifiers. If provided, the replacement
     name is used instead. All C++ keywords are already in this list."
  };

  // This is a "fake" option in that it is actually handled by
  // argv_file_scanner. We have it here to get the documentation.
  //
  std::string --options-file
  {
    "<file>",
    "Read additional options from <file> with each option appearing on a
     separate line optionally followed by space and an option value. Empty
     lines and lines starting with \cb{#} are ignored. Option values can
     be enclosed in double (\cb{\"}) or single (\cb{'}) quotes  to preserve
     leading and trailing whitespaces as well as to specify empty values.
     If the value itself contains trailing or leading quotes, enclose it
     with an extra pair of quotes, for example \cb{'\"x\"'}. Non-leading
     and non-trailing quotes are interpreted as being part of the option
     value.

     The semantics of providing options in a file is equivalent to providing
     the same set of options in the same order on the command line at the
     point where the \cb{--options-file} option is specified except that
     the shell escaping and quoting is not required. Repeat this option
     to specify more than one options file."
  };
};