Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,13 +333,13 @@ max_depth/
```

## Tree format
Choose between different tree formats.
Choose between different built-in tree formats, or create your own.
The default is `UNICODE_BOX_DRAWING`, supported by all terminals, but you can also switch to use `CLASSIC_ASCII`.

```java
// Example: FileTreeFormat.java
var prettyPrinter = FileTreePrettyPrinter.builder()
.customizeOptions(options -> options.withTreeFormat(TreeFormat.CLASSIC_ASCII))
.customizeOptions(options -> options.withTreeFormat(TreeFormats.CLASSIC_ASCII))
.build();
```

Expand All @@ -352,9 +352,6 @@ tree_format/
`-- subFile_2
```

> [!TIP]
> *Idea for a future version: option to allow usage of custom format*

# Project Information

* See [🆕CHANGELOG.md](CHANGELOG.md) for a list of released versions and detailed changes.
Expand Down
10 changes: 5 additions & 5 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
- [x] **Features**
- [x] Option: filtering
- [x] Option: ordering
- [x] Option: emojis
- [x] Option: custom emojis mapping
- [x] Option: emojis (+ custom mapping)
- [x] Option: compact directories display
- [x] Option: line extension (=additional text after the file name)
- [x] Option: children limit (static & dynamic)
- [x] Option: tree format Unicode box drawing / classic ASCII
- [x] Option: tree format (+ custom mapping)
- [x] Option: max directory depth
- [x] **Helpers**
- [x] Path matchers
Expand All @@ -29,10 +28,11 @@
- [x] SonarCloud integration
- [x] **Workflows**
- [x] Github actions
- [x] Publish on Maven Central!
- [x] Publish `0.0.x` alpha on Maven Central!

## To do
- [ ] Option: custom tree format
- [ ] Gather feedback
- [ ] Publish `0.x.0` beta on Maven Central!

## Backlog / To analyze / To implement if requested
- [ ] Rework/fix Github wiki to be up to date
Expand Down
Binary file modified assets/project-structure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.github.computerdaddyguy.jfiletreeprettyprinter.example;

import io.github.computerdaddyguy.jfiletreeprettyprinter.ChildLimits;
import io.github.computerdaddyguy.jfiletreeprettyprinter.FileTreePrettyPrinter;
import io.github.computerdaddyguy.jfiletreeprettyprinter.PathMatchers;
import io.github.computerdaddyguy.jfiletreeprettyprinter.options.ChildLimits;
import io.github.computerdaddyguy.jfiletreeprettyprinter.options.PathMatchers;

public class ChildLimitDynamic {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package io.github.computerdaddyguy.jfiletreeprettyprinter.example;

import io.github.computerdaddyguy.jfiletreeprettyprinter.FileTreePrettyPrinter;
import io.github.computerdaddyguy.jfiletreeprettyprinter.PrettyPrintOptions.TreeFormat;
import io.github.computerdaddyguy.jfiletreeprettyprinter.options.TreeFormats;

public class FileTreeFormat {

public static void main(String[] args) {
var prettyPrinter = FileTreePrettyPrinter.builder()
.customizeOptions(options -> options.withTreeFormat(TreeFormat.CLASSIC_ASCII))
.customizeOptions(options -> options.withTreeFormat(TreeFormats.CLASSIC_ASCII))
.build();
var tree = prettyPrinter.prettyPrint("src/example/resources/tree_format");
System.out.println(tree);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.computerdaddyguy.jfiletreeprettyprinter.example;

import io.github.computerdaddyguy.jfiletreeprettyprinter.FileTreePrettyPrinter;
import io.github.computerdaddyguy.jfiletreeprettyprinter.PathMatchers;
import io.github.computerdaddyguy.jfiletreeprettyprinter.options.PathMatchers;

public class Filtering {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.github.computerdaddyguy.jfiletreeprettyprinter.example;

import io.github.computerdaddyguy.jfiletreeprettyprinter.FileTreePrettyPrinter;
import io.github.computerdaddyguy.jfiletreeprettyprinter.LineExtensions;
import io.github.computerdaddyguy.jfiletreeprettyprinter.PathMatchers;
import io.github.computerdaddyguy.jfiletreeprettyprinter.options.LineExtensions;
import io.github.computerdaddyguy.jfiletreeprettyprinter.options.PathMatchers;
import java.nio.file.Path;
import java.util.function.Function;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package io.github.computerdaddyguy.jfiletreeprettyprinter.example;

import io.github.computerdaddyguy.jfiletreeprettyprinter.ChildLimits;
import io.github.computerdaddyguy.jfiletreeprettyprinter.FileTreePrettyPrinter;
import io.github.computerdaddyguy.jfiletreeprettyprinter.LineExtensions;
import io.github.computerdaddyguy.jfiletreeprettyprinter.PathMatchers;
import io.github.computerdaddyguy.jfiletreeprettyprinter.PathSorts;
import io.github.computerdaddyguy.jfiletreeprettyprinter.options.ChildLimits;
import io.github.computerdaddyguy.jfiletreeprettyprinter.options.LineExtensions;
import io.github.computerdaddyguy.jfiletreeprettyprinter.options.PathMatchers;
import io.github.computerdaddyguy.jfiletreeprettyprinter.options.PathSorts;
import java.nio.file.Path;
import java.util.Comparator;
import java.util.function.Function;
Expand Down Expand Up @@ -56,9 +56,10 @@ public static void main(String[] args) {
*/
var childLimitFunction = ChildLimits.builder()
// Hide all files under renderer and scanner packages
.add(PathMatchers.hasAbsolutePathMatchingGlob("**/io/github/computerdaddyguy/jfiletreeprettyprinter/options"), 0)
.add(PathMatchers.hasAbsolutePathMatchingGlob("**/io/github/computerdaddyguy/jfiletreeprettyprinter/renderer"), 0)
.add(PathMatchers.hasAbsolutePathMatchingGlob("**/io/github/computerdaddyguy/jfiletreeprettyprinter/scanner"), 0)
.add(PathMatchers.hasAbsolutePathMatchingGlob("**/io/github/computerdaddyguy/jfiletreeprettyprinter"), 3)
.add(PathMatchers.hasAbsolutePathMatchingGlob("**/io/github/computerdaddyguy/jfiletreeprettyprinter"), 4)
.build();

/*
Expand Down Expand Up @@ -113,22 +114,25 @@ public static void main(String[] args) {
│ └─ 🖼️ project-structure.png // This image
├─ 📂 src/main/java/
│ └─ 📂 io/github/computerdaddyguy/jfiletreeprettyprinter/
│ ├─ 📂 options/
│ │ └─ ...
│ ├─ 📂 renderer/
│ │ └─ ...
│ ├─ 📂 scanner/
│ │ └─ ...
│ ├─ ☕ FileTreePrettyPrinter.java // Main entry point
│ └─ ...
├─ 🗺️ CHANGELOG.md
├─ 📖 CONTRIBUTING.md
├─ 📄 LICENSE
├─ 📖 README.md // You're reading at this!
├─ 🆕 CHANGELOG.md
├─ 🤝 CONTRIBUTING.md
├─ ⚖️ LICENSE
├─ 📘 README.md // You're reading at this!
├─ 🗺️ ROADMAP.md
├─ 🛡️ SECURITY.md
├─ 🏗️ pom.xml
├─ 📖 release_process.md
├─ 🛠️ pom.xml
├─ 📝 release_process.md
└─ 📜 runMutationTests.sh


*/
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.computerdaddyguy.jfiletreeprettyprinter.example;

import io.github.computerdaddyguy.jfiletreeprettyprinter.FileTreePrettyPrinter;
import io.github.computerdaddyguy.jfiletreeprettyprinter.PathSorts;
import io.github.computerdaddyguy.jfiletreeprettyprinter.options.PathSorts;

public class Sorting {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.computerdaddyguy.jfiletreeprettyprinter;

import io.github.computerdaddyguy.jfiletreeprettyprinter.options.PrettyPrintOptions;
import java.io.UncheckedIOException;
import java.nio.file.Path;
import org.jspecify.annotations.NullMarked;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.computerdaddyguy.jfiletreeprettyprinter;

import io.github.computerdaddyguy.jfiletreeprettyprinter.options.PrettyPrintOptions;
import io.github.computerdaddyguy.jfiletreeprettyprinter.renderer.TreeEntryRenderer;
import io.github.computerdaddyguy.jfiletreeprettyprinter.scanner.PathToTreeScanner;
import java.util.Objects;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.computerdaddyguy.jfiletreeprettyprinter;
package io.github.computerdaddyguy.jfiletreeprettyprinter.options;

import java.nio.file.Path;
import java.nio.file.PathMatcher;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.computerdaddyguy.jfiletreeprettyprinter;
package io.github.computerdaddyguy.jfiletreeprettyprinter.options;

/**
* Utility class providing constants and factory methods for creating
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.github.computerdaddyguy.jfiletreeprettyprinter.renderer.emoji;
package io.github.computerdaddyguy.jfiletreeprettyprinter.options;

import io.github.computerdaddyguy.jfiletreeprettyprinter.PathMatchers;
import java.nio.file.Path;
import java.util.Objects;
import java.util.Optional;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.computerdaddyguy.jfiletreeprettyprinter.renderer.emoji;
package io.github.computerdaddyguy.jfiletreeprettyprinter.options;

import io.github.computerdaddyguy.jfiletreeprettyprinter.renderer.emoji.PathMatcherEmojiFunction.EmojiMatch;
import io.github.computerdaddyguy.jfiletreeprettyprinter.options.PathMatcherEmojiFunction.EmojiMatch;
import java.nio.file.PathMatcher;
import java.util.ArrayList;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.computerdaddyguy.jfiletreeprettyprinter.renderer.emoji;
package io.github.computerdaddyguy.jfiletreeprettyprinter.options;

import java.nio.file.Path;
import org.jspecify.annotations.NullMarked;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.github.computerdaddyguy.jfiletreeprettyprinter.renderer.emoji;
package io.github.computerdaddyguy.jfiletreeprettyprinter.options;

import io.github.computerdaddyguy.jfiletreeprettyprinter.PathMatchers;
import java.nio.file.PathMatcher;
import org.jspecify.annotations.NullMarked;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.computerdaddyguy.jfiletreeprettyprinter;
package io.github.computerdaddyguy.jfiletreeprettyprinter.options;

import java.nio.file.Path;
import java.nio.file.PathMatcher;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.computerdaddyguy.jfiletreeprettyprinter;
package io.github.computerdaddyguy.jfiletreeprettyprinter.options;

/**
* Utility class providing constants and factory methods for creating
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.computerdaddyguy.jfiletreeprettyprinter.renderer.emoji;
package io.github.computerdaddyguy.jfiletreeprettyprinter.options;

import java.util.Map;
import java.util.Map.Entry;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.computerdaddyguy.jfiletreeprettyprinter.renderer.emoji;
package io.github.computerdaddyguy.jfiletreeprettyprinter.options;

import java.nio.file.Path;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.computerdaddyguy.jfiletreeprettyprinter.renderer.emoji;
package io.github.computerdaddyguy.jfiletreeprettyprinter.options;

import java.nio.file.Path;
import java.nio.file.PathMatcher;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.computerdaddyguy.jfiletreeprettyprinter;
package io.github.computerdaddyguy.jfiletreeprettyprinter.options;

import java.io.IOException;
import java.io.UncheckedIOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.computerdaddyguy.jfiletreeprettyprinter.renderer.emoji;
package io.github.computerdaddyguy.jfiletreeprettyprinter.options;

import java.nio.file.Path;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.computerdaddyguy.jfiletreeprettyprinter;
package io.github.computerdaddyguy.jfiletreeprettyprinter.options;

import java.nio.file.Path;
import java.nio.file.PathMatcher;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.computerdaddyguy.jfiletreeprettyprinter;
package io.github.computerdaddyguy.jfiletreeprettyprinter.options;

import java.nio.file.Path;
import java.util.Comparator;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.github.computerdaddyguy.jfiletreeprettyprinter;
package io.github.computerdaddyguy.jfiletreeprettyprinter.options;

import io.github.computerdaddyguy.jfiletreeprettyprinter.renderer.RenderingOptions;
import io.github.computerdaddyguy.jfiletreeprettyprinter.renderer.emoji.EmojiMapping;
import io.github.computerdaddyguy.jfiletreeprettyprinter.scanner.ScanningOptions;
import java.nio.file.Path;
import java.nio.file.PathMatcher;
Expand Down Expand Up @@ -62,21 +61,7 @@ public PrettyPrintOptions withChildLimit(ToIntFunction<Path> childLimitFunction)

// ---------- Tree format ----------

public static enum TreeFormat {

/**
* Uses characters: |--, `-- and │
*/
CLASSIC_ASCII,

/**
* Uses characters: ├─, └─ and │
*/
UNICODE_BOX_DRAWING,

}

private TreeFormat treeFormat = TreeFormat.UNICODE_BOX_DRAWING;
private TreeFormat treeFormat = TreeFormats.UNICODE_BOX_DRAWING;

@Override
public TreeFormat getTreeFormat() {
Expand All @@ -85,7 +70,7 @@ public TreeFormat getTreeFormat() {

/**
* Sets the depth rendering format.
* Default is {@link TreeFormat#UNICODE_BOX_DRAWING}.
* Default is {@link TreeFormats#UNICODE_BOX_DRAWING}.
*
* @param treeFormat The format to use, cannot be <code>null</code>.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.computerdaddyguy.jfiletreeprettyprinter.renderer.emoji;
package io.github.computerdaddyguy.jfiletreeprettyprinter.options;

import java.nio.file.Path;
import java.util.Objects;
Expand Down
Loading
Loading