1 = `barectf` CLI tool usage
3 barectf ships with the `barectf` command-line interface (CLI) tool.
7 Run a `barectf` command:
11 *barectf* _COMMAND_ _COMMAND-ARGUMENTS_
13 Print the version of `barectf`:
17 *barectf* pass:[[]xref:#version-option[--version]pass:[\]]
19 Print brief general help:
23 *barectf* pass:[[]xref:#help-option[--help]pass:[\]]
25 == General description
27 The `barectf` tool has a Git-like user interface with the following
30 <<generate-command,`generate`>>::
31 Generate the C source and CTF metadata stream files of a tracer
32 from a xref:yaml:index.adoc[YAML configuration file].
34 <<show-effective-configuration-command,`show-effective-configuration`>>::
35 Print the _effective_ YAML configuration file for a given YAML
36 configuration file and inclusion directories.
38 <<show-configuration-version-command,`show-configuration-version`>>::
39 Print the major version (2 or 3) of a YAML configuration file.
45 Print brief general help and exit.
47 [[version-option]]`-V`::
49 Print the version of `barectf` and exit.
56 Generate files from configuration file:
60 *barectf generate* pass:[[]xref:#generate-prefix-option[--prefix]=__PREFIX__] pass:[[]xref:#generate-metadata-dir-option[--metadata-dir]=__MDIR__]
61 pass:[[]xref:#generate-headers-dir-option[--headers-dir]=__HDIR__] pass:[[]xref:#generate-code-dir-option[--code-dir]=__CDIR__]
62 pass:[[]xref:#generate-include-dir-option[--include-dir]=__IDIR__]...
63 pass:[[]xref:#generate-ignore-include-not-found-option[--ignore-include-not-found]pass:[\]] _CONFIG-PATH_
65 Print command's brief help:
69 *barectf generate* xref:#generate-help-option[--help]
71 === Command name aliases
77 The `barectf generate` command reads the xref:yaml:index.adoc[YAML
78 configuration file] `__CONFIG-PATH__` to produce:
80 [%autowidth.stretch, cols="d,a"]
82 |File name |Description
85 |The CTF metadata stream file.
87 |`__HDIR__/__FPREFIX__.h`
88 |The generated tracer's public C{nbsp}header file.
90 |`__HDIR__/__FPREFIX__-bitfield.h`
91 |Internal macros for the generated tracer (included by `__FPREFIX__.c`).
93 |`__CDIR__/__FPREFIX__.c`
94 |The generated tracer's C{nbsp}source code.
97 See xref:lel[Build the generated C{nbsp}source code] to learn how to
98 build the C{nbsp}source which the `generate` command produces.
100 In the list above, `__FPREFIX__` is:
102 Without the <<generate-prefix-option,`--prefix`>> option::
103 If the `__CONFIG-PATH__` file has a file name xref:yaml:cfg-obj.adoc#prefix-prop[prefix option]:::
104 The `__CONFIG-PATH__` file's file name prefix option.
108 With the <<generate-prefix-option,`--prefix`>> option::
109 `__PREFIX__`, without trailing underscores.
111 For example, if `__PREFIX__` is `my_tracer_`, then `__FPREFIX__` is
114 By default, `__MDIR__`, `__HDIR__`, and `__CDIR__` are the current
115 working directory. Use the
116 <<generate-metadata-dir-option,`--metadata-dir`>>,
117 <<generate-headers-dir-option,`--headers-dir`>>, and
118 <<generate-code-dir-option,`--code-dir`>> to specify other output
121 Therefore, by default, the `generate` command writes the `metadata`,
122 `barectf.h`, `barectf-bitfield.h`, and `barectf.c` files to the current
125 If you use the <<prefix-option,`--prefix`>> option, then all the
126 public C{nbsp}identifiers in `__FPREFIX__.h` and `__FPREFIX__.c` begin
127 with `__PREFIX__`. Otherwise, they begin with:
129 If the `__CONFIG-PATH__` file has an identifier prefix option::
130 The `__CONFIG-PATH__` file's identifier prefix option.
135 Add directories to be searched into for inclusion files before the
136 default inclusion directories with the repeatable
137 <<generate-include-dir-option,`--include-dir`>> option.
139 By default, if `barectf` can't find an inclusion file while processing
140 the `__CONFIG-PATH__` file, the command prints an error and
141 <<exit-status,exits>> with a non-zero status. Force
142 `barectf generate` to continue silently instead with its
143 <<generate-ignore-include-not-found-option,`--ignore-include-not-found`>>
148 [[generate-code-dir-option]]`-c __CDIR__`::
149 `--code-dir=__CDIR__`::
150 Write the C{nbsp}source file to the directory `__CDIR__` instead of
151 the current working directory.
153 [[generate-headers-dir-option]]`-H __HDIR__`::
154 `--headers-dir=__HDIR__`::
155 Write C{nbsp}header files to the directory `__HDIR__` instead of
156 the current working directory.
158 [[generate-help-option]]`-h`::
160 Print the `generate` command's brief help and exit.
162 [[generate-ignore-include-not-found-option]]`--ignore-include-not-found`::
163 Continue to process the `__CONFIG-PATH__` file when inclusion
166 [[generate-include-dir-option]]`-I __IDIR__`::
167 `--include-dir=__IDIR__`::
168 Add `__IDIR__` to the list of directories to be searched into for
169 inclusion files before the default inclusion directories.
171 The default inclusion directories are:
173 . The current working directory.
174 . The directory containing the standard inclusion files
175 (like `stdint.yaml`).
177 [[generate-metadata-dir-option]]`-m __MDIR__`::
178 `--metadata-dir=__MDIR__`::
179 Write the CTF metadata stream file to the directory `__MDIR__`
180 instead of the current working directory.
182 [[generate-prefix-option]]`-p __PREFIX__`::
183 `--prefix=__PREFIX__`::
184 Override the default or `__CONFIG-PATH__` file's file and
185 identifier prefixes with:
188 `__PREFIX__`, without trailing underscores.
194 The default file name prefix is `barectf`.
196 The default identifier prefix is `barectf_`.
199 [[show-effective-configuration-command]]
200 == `show-effective-configuration` command
204 Show effective configuration:
208 *barectf show-effective-configuration* pass:[[]xref:#show-effective-configuration-include-dir-option[--include-dir]=__IDIR__]...
209 pass:[[]xref:#show-effective-configuration-ignore-include-not-found-option[--ignore-include-not-found]pass:[\]] _CONFIG-PATH_
211 Print command's brief help:
215 *barectf show-effective-configuration* xref:#show-effective-configuration-help-option[`--help`]
217 === Command name aliases
219 * `show-effective-config`
220 * `show-effective-cfg`
224 The `barectf show-effective-configuration` command reads the
225 xref:yaml:index.adoc[YAML configuration file] `__CONFIG-PATH__` and
226 prints an equivalent, _effective_ YAML configuration.
228 See the xref:yaml:index.adoc#stages[processing stages] of a YAML
229 configuration file to learn what an effective configuration is.
231 Moreover, the `show-effective-configuration` command validates the
232 `__CONFIG-PATH__` file. In other words, if the command
233 <<exit-status,exits>> with status{nbsp}0, the
234 <<generate-command,`generate` command>> using the same options and
235 `__CONFIG-PATH__` file would also succeed.
237 Add directories to be searched into for inclusion files before the
238 default inclusion directories with the repeatable
239 <<show-effective-configuration-include-dir-option,`--include-dir`>> option.
241 By default, if `barectf` can't find an inclusion file while processing
242 the `__CONFIG-PATH__` file, the command prints an error and
243 <<exit-status,exits>> with a non-zero status. Force
244 `barectf show-effective-configuration` to continue silently instead
246 <<show-effective-configuration-ignore-include-not-found-option,`--ignore-include-not-found`>>
251 [[show-effective-configuration-help-option]]`-h`::
253 Print the `show-effective-configuration` command's
256 [[show-effective-configuration-ignore-include-not-found-option]]`--ignore-include-not-found`::
257 Continue to process the `__CONFIG-PATH__` file when inclusion
260 [[show-effective-configuration-include-dir-option]]`-I __IDIR__`::
261 `--include-dir=__IDIR__`::
262 Add `__IDIR__` to the list of directories to be searched into for
263 inclusion files before the default inclusion directories.
265 The default inclusion directories are:
267 . The current working directory.
268 . The directory containing the standard inclusion files
269 (like `stdint.yaml`).
271 [[show-configuration-version-command]]
272 == `show-configuration-version` command
276 Show configuration file's version:
280 *barectf show-configuration-version* _CONFIG-PATH_
282 Print command's brief help:
286 *barectf show-configuration-version* xref:#show-configuration-version-help-option[`--help`]
288 === Command name aliases
290 * `show-config-version`
295 The `barectf show-configuration-version` command reads the
296 xref:yaml:index.adoc[YAML configuration file] `__CONFIG-PATH__` and
297 prints its version, which is either 2 or 3.
299 The `show-configuration-version` does _not_ validate the
300 `__CONFIG-PATH__` file.
304 [[show-configuration-version-help-option]]`-h`::
306 Print the `show-configuration-version` command's brief help