Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/morinokami/ptree

tree command prettified with emojis🌲
https://github.com/morinokami/ptree

Last synced: 10 days ago
JSON representation

tree command prettified with emojis🌲

Awesome Lists containing this project

README

        

# ptree

ptree prettifies `tree` command with emojis like this:

```
$ ptree
πŸ“ .
β”œβ”€β”€ πŸ€– binary.bin
β”œβ”€β”€ πŸ“„ document.txt
β”œβ”€β”€ 🦏 javascript.js
β”œβ”€β”€ πŸ“ markdown.md
β”œβ”€β”€ πŸͺ perl.pl
β”œβ”€β”€ 🐍 python.py
└── πŸ¦€ rust.rs

0 directory, 7 files
```

## Installation

```sh
$ npm install -g @shf0811/ptree
```

## Usage

* List contents of directories:

```
$ ptree .
πŸ“ .
β”œβ”€β”€ πŸ“ bar
β”‚ └── πŸ“„ baz.ts
└── πŸ“„ foo.js

1 directory, 2 files
```

* Specify the maximum display depth of the directory tree:

```
$ ptree --level 1 .
πŸ“ .
β”œβ”€β”€ πŸ“ bar
└── πŸ“„ foo.js

1 directory, 1 file
```

* Specify the emojis to show:

```
$ ptree --emojis '{".js": "🦏", ".ts": "πŸ¦•"}' .
πŸ“ .
β”œβ”€β”€ πŸ“ bar
β”‚ └── πŸ¦• baz.ts
└── 🦏 foo.js

1 directory, 2 files
```

* List only directories:

```
$ ptree --dir .
πŸ“ .
└── πŸ“ bar

1 directory
```

* List only those files that matches the given pattern:

```
$ ptree --include 'foo*' .
πŸ“ .
β”œβ”€β”€ πŸ“ bar
└── πŸ“„ foo.js

1 directory, 1 file
```

* List only those files that doesn't match the given pattern:

```
$ ptree --exclude 'foo*' .
πŸ“ .
└── πŸ“ bar
└── πŸ“„ baz.ts

1 directory, 1 file
```

* Show help:

```
$ ptree --help
ptree [options]

Options:
--version Show version number [boolean]
-a, --all Print all files and directories including those starting with a
dot [boolean] [default: false]
-d, --dir Print only directories [boolean] [default: false]
-e, --emojis Mapping of file extensions to emojis [string] [default: "{}"]
-l, --level Maximum depth to traverse [number] [default: Infinity]
-i, --include Include files matching this pattern [string]
-x, --exclude Exclude files matching this pattern [string]
-h, --help Show help [boolean]
```

## Customization

You can specify the emojis to use beforehand by creating a config file named `.ptree.json` in your home folder like this:

```
$ cat ~/.ptree.json
{
"emojis": {
".js": "🦏",
".ts": "πŸ¦•"
}
}
```

Now you don't have to use the option each time:

```
$ ptree .
πŸ“ .
β”œβ”€β”€ πŸ“ bar
β”‚ └── πŸ¦• baz.ts
└── 🦏 foo.js

1 directory, 2 files
```