How to generate the tree path of your directory

Danilo Assis - Jul 6 '22 - - Dev Community

The Tree is a cool tool to exemplify project directories, whether for tutorials, doubts, explanations for your team, etc.

Precisely because it's a cool feature, I'll be showing you how to easily install it on macOS and generate the directory of a GraphQL API as an example.

How to Install macOS

make sure you have brew installed on your pc and run the command below:

daniloab$ brew install tree
Enter fullscreen mode Exit fullscreen mode

Once installed test the command with which tree. The result should be like:

daniloab:graphql-real-world-server daniloassis$ which tree
/opt/homebrew/bin/tree
Enter fullscreen mode Exit fullscreen mode

Once having Tree installed successfully, type in your terminal tree to get you directory path:

daniloab:graphql-real-world-server daniloassis$ tree
.
├── README.md
├── babel.config.js
├── package.json
├── schema.graphql
├── src
│   ├── app.ts
│   ├── config.ts
│   ├── index.ts
│   ├── modules
│   │   ├── LikeNewSubscription.ts
│   │   ├── LikeType.ts
│   │   ├── TalkType.ts
│   │   └── UserType.ts
│   ├── pubSub.ts
│   └── schema
│       ├── MutationType.ts
│       ├── QueryType.ts
│       ├── SubscriptionType.ts
│       └── schema.ts
├── tsconfig.json
├── webpack
│   └── ReloadServerPlugin.js
├── webpack.js
└── yarn.lock

4 directories, 20 files
Enter fullscreen mode Exit fullscreen mode

For other ways of installing in macOS take a look at this link

https://superuser.com/questions/359723/mac-os-x-equivalent-of-the-ubuntu-tree-command

How to Install Ubuntu

through apt-get you can do the installation easily. In your terminal run:

$ sudo apt-get install tree
Enter fullscreen mode Exit fullscreen mode

Installing Tree successfully star to use it to list your directories.

Automate

By being simple and fast, the tree starts to help you daily in tasks that previously could take more operational time from your routine.

Always seek to automate all those manual tasks that take up your time and don't leave you free to direct your focus to what is most important.

The repo used as example is a result from a talk of mine about GraphQL. Feel free to enjoy slides clicking here GraphQL Real World

Links:
Slides https://github.com/daniloab/graphql-real-world-server
Repo with a real GraphQL Server https://github.com/daniloab/graphql-real-world-server
References

Photo by Joel & Jasmin Førestbird on Unsplash

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player