npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan HefnerΒ  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2024 – Pkg Stats / Ryan Hefner

@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