A flexible and fun directory tree generator for the command line.
npm install -g poplr
# Generate a tree with default settings
poplr
# Or directly use the tree command
poplr tree
- 📁 Clean, customizable directory tree visualization
- 🎨 Multiple output formats (Console, Markdown, Text, JSON, HTML)
- 🔍 Smart sorting (directories first, by name, size, or type)
- 🎯 File and directory filtering
- ⚙️ Configurable through
.poplrrc
files - 🖼️ Optional file type icons
- 📊 Optional directory statistics
- 🎭 Fancy or simple characters for tree structure
Simply run poplr
and choose from the menu:
- Quick tree (default settings)
- Custom tree (with export options)
- About poplr
# Basic tree generation
poplr tree
# Show file sizes
poplr tree -s
# Show full paths
poplr tree -p
# Set maximum depth
poplr tree -d 2
# Show root directory
poplr tree -r
# Change sort order
poplr tree --sort type
# Show directory statistics
poplr tree --stats
# Export as markdown
poplr tree -f markdown
Available options:
-
-f, --format <type>
- Output format (ascii, markdown, txt, json, html) -
-d, --max-depth <number>
- Maximum depth to traverse -
-s, --show-size
- Show file sizes -
-p, --full-path
- Show full paths -
-r, --show-root
- Show root directory -
--stats
- Show directory summary -
--sort <type>
- Sort by (name, type, size, extension)
# Export examples
poplr tree -f markdown > tree.md
poplr tree -f html > tree.html
poplr tree -f json > tree.json
poplr tree -f txt > tree.txt
You can create a global or local configuration file:
# Create local config
poplr init
# Create global config
poplr init -g
# View current configuration
poplr config
{
"display": {
"fancy": true,
"useIcons": false,
"useColors": true,
"showSize": false,
"showStats": false,
"showRoot": false,
"fullPath": false
},
"sorting": {
"enabled": true,
"default": "directory-first"
},
"filtering": {
"maxDepth": null,
"exclude": ["node_modules", ".git", ".DS_Store"],
"include": ["README.md"]
},
"export": {
"defaultFormat": "ascii",
"outputDir": "./",
"timestamp": false
}
}
├── src/
│ ├── index.js
│ └── utils/
│ └── helper.js
└── package.json
The same as console output but saved to a text file:
├── src/
│ ├── index.js
│ └── utils/
│ └── helper.js
└── package.json
## Directory Structure
* src/
* index.js
* utils/
* helper.js
* package.json
Generates a styled HTML page with the tree structure:
<!DOCTYPE html>
<html>
<head>
<title>Directory Tree</title>
</head>
<body>
<pre>
├── src/
│ ├── index.js
│ └── utils/
│ └── helper.js
└── package.json
</pre>
</body>
</html>
{
"generated": "2024-11-05T20:19:05.327Z",
"config": {
"format": "json",
"showSize": true,
...
},
"tree": "..."
}
-
name
- Alphabetical order -
directory-first
(default) - Directories at top, then files -
type
- Group by file type -
size
- Largest files first -
extension
- Group by file extension
# Generate a simple tree
poplr tree
# Export as markdown with file sizes
poplr tree -f markdown -s
# Show only 2 levels deep with stats
poplr tree -d 2 --stats
# Custom tree with interactive options
poplr
# Then select "Custom tree" from the menu
- Command line arguments (highest priority)
- Local .poplrrc (in current directory)
- Global .poplrrc (in home directory)
- Default settings (lowest priority)
Contributions are welcome! Please feel free to submit a Pull Request.
MIT
Rick Knowlton | tiny.
Made with ☕️ by tiny.