@shf0811/ptree
v0.0.2
Published
tree command prettified with emojisπ²
Downloads
3
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
$ 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 <path> [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