Skip to content

Commit af87d9f

Browse files
Max depth
1 parent 860b53e commit af87d9f

File tree

22 files changed

+263
-30
lines changed

22 files changed

+263
-30
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ implementation "com.github.computerdaddyguy:jfiletreeprettyprinter:0.1.0"
7070
* [Emojis ❤️](#emojis-%EF%B8%8F)
7171
* [Children limit](#children-limit)
7272
* [Compact directories](#compact-directories)
73+
* [Max depth](#max-depth)
7374

7475
## Tree format
7576
Choose between different tree formats.
@@ -213,6 +214,27 @@ single_directory_child/
213214
└─ file3
214215
```
215216

217+
## Max depth
218+
You can customize the default max depth (default is 20).
219+
220+
```java
221+
// Example: MaxDepth.java
222+
var prettyPrinter = FileTreePrettyPrinter.builder()
223+
.customizeOptions(options -> options.withMaxDepth(3))
224+
.build();
225+
```
226+
```
227+
max_depth/
228+
└─ level1/
229+
├─ file1#1
230+
├─ file1#2
231+
└─ level2/
232+
├─ file2#1
233+
├─ file2#2
234+
└─ level3/
235+
└─ ... (max depth reached)
236+
```
237+
216238
# Changelog
217239
See [CHANGELOG.md](CHANGELOG.md) for released versions.
218240

ROADMAP.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
- [x] Add examples & README
1111
- [x] Implement emojis for files
1212
- [x] Unify dir-in-a-row into a single entry option
13-
- [ ] Max depth options
13+
- [x] Max depth options
14+
- [ ] Cleaner code
1415
- [ ] Refactor unit tests (custom assert?)
1516
- [ ] Publish on Maven Central!
1617

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package io.github.computerdaddyguy.jfiletreeprettyprinter.example;
2+
3+
import io.github.computerdaddyguy.jfiletreeprettyprinter.FileTreePrettyPrinter;
4+
5+
public class MaxDepth {
6+
7+
public static void main(String[] args) {
8+
var prettyPrinter = FileTreePrettyPrinter.builder()
9+
.customizeOptions(options -> options.withMaxDepth(3))
10+
.build();
11+
var tree = prettyPrinter.prettyPrint("src/example/resources/max_depth");
12+
System.out.println(tree);
13+
}
14+
15+
}

src/example/resources/max_depth/level1/file1#1

Whitespace-only changes.

src/example/resources/max_depth/level1/file1#2

Whitespace-only changes.

src/example/resources/max_depth/level1/level2/file2#1

Whitespace-only changes.

src/example/resources/max_depth/level1/level2/file2#2

Whitespace-only changes.

src/example/resources/max_depth/level1/level2/level3/file3#1

Whitespace-only changes.

src/example/resources/max_depth/level1/level2/level3/file3#2

Whitespace-only changes.

src/example/resources/max_depth/level1/level2/level3/level4/file4#1

Whitespace-only changes.

0 commit comments

Comments
 (0)