You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
atree - print a tree of asciidoc document inclusions
2
-
3
-
syntax: atree [file|directory|option]...
1
+
# atree - print a tree of asciidoc document inclusions
4
2
5
3
Prints a tree of asciidoc document inclusions.
6
4
5
+
syntax:
6
+
7
+
```
8
+
atree [file|directory|option]...
9
+
```
10
+
7
11
8
-
INPUT
9
-
-----
12
+
## Input
10
13
11
14
The possible parameters are:
12
15
@@ -19,123 +22,130 @@ You can specify as many inputs as needed. Inputs are processed in order of appea
19
22
20
23
If no input files or directories are specified, the current directory is tried.
21
24
22
-
Path handling details
23
-
---------------------
25
+
### Path handling details
24
26
25
27
When atree encounters a glob pattern, it expands it first and then handles the resulting paths as if listed manually.
26
28
27
29
If a path is a file, atree tries to parse and analyze it as an AsciiDoc file. If a path is a directory instead, atree checks for existence of files in this order:
28
30
29
-
1. master.adoc
30
-
2. index.adoc
31
-
3. any *.adoc file, but only if there is just a single such file
31
+
1.`master.adoc`
32
+
2.`index.adoc`
33
+
3. any `*.adoc` file, but only if there is just a single such file
32
34
33
35
34
-
OPTIONS
35
-
-------
36
+
### Options
36
37
37
-
-a Use annotated output (default).
38
-
-b Use full path output.
39
-
-l Use literal include line output.
38
+
*`-a` Use annotated output (default).
39
+
*`-b` Use full path output.
40
+
*`-l` Use literal include line output.
40
41
41
-
-c Display commented-out includes in annotated mode.
42
-
-x Analyze commented-out includes.
43
-
-h Hide hints for human user.
42
+
*`-c` Display commented-out includes in annotated mode.
43
+
*`-x` Analyze commented-out includes.
44
+
*`-h` Hide hints for human user.
44
45
45
-
All options in the second group have their inverse in uppercase, which is also the default state. For example, atree does not show commented out includes by default, but you can get them with -c, and later return to the default with -C.
46
+
All options in the second group have their inverse in uppercase, which is also the default state. For example, atree does not show commented out includes by default, but you can get them with `-c`, and later return to the default with `-C`.
46
47
47
48
48
-
OUTPUT
49
-
------
49
+
## Output
50
50
51
51
Output differs by mode. Default mode is annotated.
52
52
53
-
Annotated output
54
-
----------------
53
+
### Annotated output
55
54
56
55
This output mode is intended for consumption by humans. Included files are printed in order of appearance. Indentation shows the level of nesting. If the inclusion of a file is modified in some way, this is displayed:
57
56
58
-
* If a file is included, but the inclusion is commented out, the line with the included path begins with the // characters, to idicate the file is included but does not affect output:
57
+
* If a file is included, but the inclusion is commented out, the line with the included path begins with the `//` characters, to indicate the file is included but does not affect output:
59
58
60
-
// this-is-a-commented-out-file.adoc
59
+
```
60
+
// this-is-a-commented-out-file.adoc
61
+
```
61
62
62
63
* If a file is included, but the inclusion is altered by conditionals, an additional line is shown which explains the conditionals, such as:
63
64
64
-
modules/developer/con_hardening_c_cpp_code.adoc
65
-
\- !!! ifndef::developer-book
65
+
```
66
+
modules/developer/con_hardening_c_cpp_code.adoc
67
+
\- !!! ifndef::developer-book
68
+
```
66
69
67
70
* If a file can not be read, its inclusion will be displayed, but no includes inside that file can be analyzed.
68
71
69
72
* If a file cannot be analyzed, the reason will be shown with flags. The flags are:
70
73
71
-
R! the file includes itself, infinitely recursive inclusion
72
-
N! the file does not exist
73
-
X! the file name is not valid
74
+
* `R!` the file includes itself, infinitely recursive inclusion
75
+
* `N!` the file does not exist
76
+
* `X!` the file name is not valid
74
77
75
-
Example of outputs with flags:
78
+
Example of outputs with flags:
76
79
77
-
N! some/nonexistent/file.adoc
78
-
//R! the-same-file.adoc
79
-
X! an|invalid*path/somefile.adoc
80
+
```
81
+
N! some/nonexistent/file.adoc
82
+
//R! the-same-file.adoc
83
+
X! an|invalid*path/somefile.adoc
84
+
```
80
85
81
86
82
-
Full path output
83
-
----------------
87
+
### Full path output
84
88
85
89
This mode is intended for consumption by other tools. The output consists only of absolute paths, one on a line. No indenting to show include level is printed. Commented out files will not be listed. Conditionals and flags are not displayed. Invalid or nonexistent files will still be listed.
86
90
87
-
Note that using the -c option will enable analysis of commented out includes, but they will not be shown.
91
+
Note that using the `-c` option will enable analysis of commented out includes, but they will not be shown.
88
92
89
-
Literal output
90
-
--------------
93
+
### Literal output
91
94
92
95
This mode prints include lines as encountered in the files. Handling of flags, conditions, comments etc. is identical to full path output.
93
96
94
-
The top level file has no include statement and therefore has a special line: "<top: the-top-file.adoc>".
97
+
The top level file has no include statement and therefore has a special line: `<top: the-top-file.adoc>`.
95
98
96
-
Note that attributes are expanded before this listing, so the icludeds are not verbatim as shown in the files.
99
+
Note that attributes are expanded before this listing, so the includes are not verbatim as shown in the files.
* AsciiDoctor apparently uses some special handling for absolute paths. This syntax is not understood by atree and the file will be treated as non-existent (`N!`).
122
131
123
-
* AsciiDoctor apparently uses some special handling for absolute paths. This syntax is not understood by atree and the file will be treated as non-existent (N!).
124
132
See also https://github.com/redhat-documentation/tools/issues/21
125
133
126
134
* If an attribute is used in the include macro, the attribute must be defined in the document tree. There is no way to define an attribute manually / externally. Because undefined attributes can not not expanded, includes containing these are displayed, but the actual files can not be loaded and thus any further inclusions are not shown.
127
135
128
136
* All includes in comments are listed, including these that are not intended as part of the document, but only comment. There is no way to distinguish these automatically.
129
137
130
138
131
-
HINTS
132
-
-----
139
+
## Hints
133
140
134
141
* If there is only a single AsciiDoc file in the directory, atree will assume that is the one you want analyzed, even if you do not specify it.
135
142
136
-
* You can specify the input with glob patterns, including directory traversal /**/. This lets you construct very powerful queries.
143
+
* You can specify the input with glob patterns, including directory traversal `/**/`. This lets you construct very powerful queries.
137
144
138
145
* You can pipe atree output to egrep to add search and highlighting:
0 commit comments