A command-line tool for visualizing directory structures
Project description
Recursivist
A beautiful command-line tool for visualizing directory structures with rich formatting, color-coding, and multiple export options.
Features
- ๐จ Colorful Visualization: Each file type is assigned a unique color for easy identification
- ๐ณ Tree Structure: Displays your directories in an intuitive, hierarchical tree format
- ๐ Smart Filtering: Easily exclude directories and file extensions you don't want to see
- ๐งฉ Gitignore Support: Automatically respects your
.gitignorepatterns - ๐ Multiple Export Formats: Export to TXT, JSON, HTML, and Markdown
- ๐ Simple Interface: Intuitive command-line interface with smart defaults
Installation
From PyPI
pip install recursivist
From Source
git clone https://github.com/ArmaanjeetSandhu/recursivist.git
cd recursivist
pip install .
Usage
Basic Usage
Just run the command in any directory:
recursivist visualize
This will show a colorful tree of the current directory structure in your terminal.
Advanced Options
# Visualize a specific directory
recursivist visualize /path/to/directory
# Exclude specific directories
recursivist visualize --exclude node_modules .git venv
# Exclude file extensions
recursivist visualize --exclude-ext .pyc .log .cache
# Use a gitignore-style file
recursivist visualize --ignore-file .gitignore
# Export to various formats
recursivist visualize --export txt json html md
# Export to a specific directory
recursivist visualize --export md --output-dir ./exports
# Custom filename prefix for exports
recursivist visualize --export json --prefix my-project
# View the current version
recursivist version
# Generate shell completion
recursivist completion bash > ~/.bash_completion.d/recursivist
Command Overview
| Command | Description |
|---|---|
visualize |
Display and export directory structures |
completion |
Generate shell completion scripts |
version |
Show the current version |
Command Options for visualize
| Option | Short | Description |
|---|---|---|
--exclude |
-e |
Directories to exclude (space-separated or multiple flags) |
--exclude-ext |
-x |
File extensions to exclude (space-separated or multiple flags) |
--ignore-file |
-i |
Ignore file to use (e.g., .gitignore) |
--export |
-f |
Export formats: txt, json, html, md |
--output-dir |
-o |
Output directory for exports |
--prefix |
-p |
Prefix for exported filenames |
--verbose |
-v |
Enable verbose output |
Examples
Basic Directory Visualization
recursivist visualize
This will produce output similar to:
๐ my-project
โโโ ๐ src
โ โโโ ๐ main.py
โ โโโ ๐ utils.py
โ โโโ ๐ tests
โ โโโ ๐ test_main.py
โ โโโ ๐ test_utils.py
โโโ ๐ README.md
โโโ ๐ requirements.txt
โโโ ๐ setup.py
Export to Multiple Formats
recursivist visualize --export txt md --output-dir ./docs
This exports the directory structure to both text and markdown formats in the ./docs directory.
Exclude Unwanted Directories and Files
recursivist visualize --exclude node_modules .git --exclude-ext .pyc .log
This shows the directory tree while ignoring the node_modules and .git directories, as well as any .pyc and .log files.
Export Formats
Text (TXT)
A simple ASCII tree representation that can be viewed in any text editor.
JSON
A structured JSON format that can be easily parsed by other tools or scripts.
HTML
An HTML representation with styling that can be viewed in any web browser.
Markdown (MD)
A markdown representation that renders nicely on platforms like GitHub.
Shell Completion
Recursivist supports shell completion for easier command entry. Generate completion scripts with:
# For Bash
recursivist completion bash > ~/.bash_completion.d/recursivist
# For Zsh
recursivist completion zsh > ~/.zsh/completion/_recursivist
# For Fish
recursivist completion fish > ~/.config/fish/completions/recursivist.fish
# For PowerShell
recursivist completion powershell > recursivist.ps1
Advanced Usage
Using with Git Repositories
When working with Git repositories, you can use your existing .gitignore file:
recursivist visualize --ignore-file .gitignore
Integration with Other Tools
The JSON export format allows for easy integration with other tools:
# Export to JSON
recursivist visualize --export json --prefix myproject
# Use with jq for additional processing
cat myproject.json | jq '.structure | keys'
Development
Setting Up Development Environment
# Clone the repository
git clone https://github.com/ArmaanjeetSandhu/recursivist.git
cd recursivist
# Create a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install development dependencies
pip install -e ".[dev]"
Running Tests
# Run tests
pytest
Building the Package
# Install build tools
pip install build
# Build the package
python -m build
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Acknowledgements
Author
Armaanjeet Singh Sandhu
- Email: armaanjeetsandhu430@gmail.com
- GitHub: ArmaanjeetSandhu
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file recursivist-0.1.0.tar.gz.
File metadata
- Download URL: recursivist-0.1.0.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5984932e6cce0ca18cf049d5279710d9c5fe6a809a4e31bbbdcff7f3cc71c78
|
|
| MD5 |
9fa391197c4007f7f687e7606fc1784d
|
|
| BLAKE2b-256 |
15934d0ae8a561a860d0b9983dd3f3a136109ede8828bf9f459ae1c6ef4d1a92
|
File details
Details for the file recursivist-0.1.0-py3-none-any.whl.
File metadata
- Download URL: recursivist-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e048eb59177d4e8120ba735d2517702a113928296e188441e14c78da1f03bb2f
|
|
| MD5 |
319e11a418b7e17d8dc61309d5a369fa
|
|
| BLAKE2b-256 |
1202ef3df3495f1718d4c8e61122cd27e4c683f153bec801c8709781a71707da
|