Having a graphical representation of a tree command

0 votes
asked Oct 17, 2019 in Wanted features by Antonio

The tree command is really useful to show a directory structure... but it would be nicer with an image.

It would be great to have a graphical representation of the `tree` command. You just copy/past the output into a PlantUML diagram, and you get a nice image:

rest-fight/
├── pom.xml
└── src
    ├── main
    │   ├── java
    │   │   └── io
    │   │       └── quarkus

3 Answers

0 votes
answered Oct 17, 2019 by plantuml (295,920 points)
Could you post it some examples of text created by this 'tree' command ?

This will help. Thanks !
commented Oct 18, 2019 by Antonio

.

├── bootstrap.sh

├── mvnw

├── mvnw.cmd

├── pom.xml

├── rest-fight.iml

└── src

    ├── main

    │   ├── docker

    │   │   ├── Dockerfile.jvm

    │   │   └── Dockerfile.native

    │   ├── java

    │   │   └── io

    │   │       └── quarkus

    │   │           └── workshop

    │   │               └── superheroes

    │   │                   └── fight

    │   │                       ├── Fight.java

    │   │                       ├── FightApplication.java

    │   │                       ├── FightResource.java

    │   │                       ├── FightService.java

    │   │                       ├── Fighters.java

    │   │                       ├── client

    │   │                       │   ├── Hero.java

    │   │                       │   ├── HeroService.java

    │   │                       │   ├── Villain.java

    │   │                       │   └── VillainService.java

    │   │                       ├── health

    │   │                       │   ├── DatabaseConnectionHealthCheck.java

    │   │                       │   └── PingFightResourceHealthCheck.java

    │   │                       └── kafka

    │   │                           └── KafkaWriter.java

    │   └── resources

    │       ├── META-INF

    │       │   └── resources

    │       │       └── index.html

    │       ├── application.properties

    │       ├── banner.txt

    │       └── import.sql

    └── test

        └── java

            └── io

                └── quarkus

                    └── workshop

                        └── superheroes

                            └── fight

                                ├── FightResourceTest.java

                                └── client

                                    ├── MockHeroService.java

                                    └── MockVillainService.java

commented Oct 18, 2019 by Antonio

Some flatter structure :

.
├── extension-architecture.puml
├── introduction-physical-architecture.puml
├── messaging-architecture.puml
├── microservices-physical-architecture.puml
├── observability-physical-architecture.puml
├── quarkus-http-architecture.puml
├── rest-physical-architecture.puml
└── style.puml

And the same but from a different root directory (. is replaced by the directory name)

plantuml/
├── extension-architecture.puml
├── introduction-physical-architecture.puml
├── messaging-architecture.puml
├── microservices-physical-architecture.puml
├── observability-physical-architecture.puml
├── quarkus-http-architecture.puml
├── rest-physical-architecture.puml
└── style.puml

commented Oct 22, 2019 by cprn (230 points)

Your example run as explained in my answer.

0 votes
answered Oct 18, 2019 by cprn (230 points)
edited Oct 22, 2019 by cprn

There's a tree widget with Salt:

@startsalt
{
{T
+ World
++ America
+++ Canada
+++ USA
++++ New York
++++ Boston
+++ Mexico
++ Europe
+++ Italy
+++ Germany
++++ Berlin
++ Africa
}
}
@endsalt

With this in mind, would it be sufficient to have a script that translates `tree` output to the correct Salt input? From the top of my head I came up with this:

tree --noreport | sed -e 's/├── \|└── /+ /g' -e 's/│   \|    /+/g' -e 's/^/+/'

You need to fix a space in the 1st line manually, though.

0 votes
answered Dec 22, 2024 by kirchsth (7,260 points)

I found following solution/documentation (I think it was implemented ~Oct. 2023)

PlantUML Wiki Documentation files-diagram

@startfiles
!theme crt-amber

/.github/
/tests/v1/<&wifi> example_test.py\n<s:red>fkdsjfal
/doc/dummy.doc
<note>
this is a note
on two lines
</note>
/LICENSE

@endfiles

https://www.plantuml.com/plantuml/uml/9Owzgi9048NxUOgzpUrkXjlA4WAIGX0RMq4ssLcpkZzXPsBCsviedE8SpbTy3OifudmWXXyPA9BgY_oPs541mEhcPPWw11HYONp-e_wTlVErefU9Ow3hTbJZSacQTuLixHwMxyu4G9jxj5ECIxKsq2aBrI23PxN6g6r3Jahch89FnA3no-3ni6zFvnQWeMG_Scy0



BR Helmut 

PS.: I think the symbols cannot be changed 

commented Dec 23, 2024 by The-Lu (76,660 points)

Hi all,

Then here is the corresponding diagram:

@startfiles
/rest-fight/pom.xml
/rest-fight/src/main/java/io/quarkus/
@endfiles

Regards,
Th.

...