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
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
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
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
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
- https://linuxhint.com/tree-command-in-ubuntu/
- https://superuser.com/questions/359723/mac-os-x-equivalent-of-the-ubuntu-tree-command
Photo by Joel & Jasmin Førestbird on Unsplash
Top comments (2)
nice article, I like to use
tree -L 3
the flag -L says how much level I want to printthanks, also good to know!