A simple CLI tool to print the current folder/project structure in a tree view. Perfect for developers who want a quick visual overview of their project directories.
- Recursively prints all folders and files from the current directory.
- Easy to install and use.
- Lightweight with minimal dependencies.
- Ignores
.gitand files/folders in.gitignore - Additional ignore options via CLI flags
--ignore-files: Ignore specific files or directories--ignore-pattern: Ignore files matching glob patterns--dirs-only: Show only directories, no files.--as-json: Show tree as a nested JSON object.
Install as a dev dependency:
npm install --save-dev treeview-cliRun using npx:
npx treeviewOr add an npm script in your package.json:
"scripts": {
"treeview": "treeview"
}Then run:
npm run treeviewtreeview --ignore-files temp.txt build/ dist/treeview --ignore-pattern "*.log" "*.tmp" "test-*"treeview --ignore-files temp.txt --ignore-pattern "*.log" "*.tmp"treeview --dirs-onlytreeview --as-jsontreeview --helpExample output (Visual Treeview):
/Users/ved/projects/my-app
├── src
│ ├── components
│ ├── pages
│ └── utils
├── public
└── tests
Example output (JSON Treeview):
{
"/Users/ved/projects/my-app": {
"public": {},
"src": {
"components": {},
"pages": {},
"utils": {}
},
"tests": {}
}
}--depth <n>: Limit recursion to n levels.
- Ensure Node.js is installed on your system
- Install dependencies:
npm installTo run the test suite:
npm testThis will execute the test file using Node.js to verify the functionality of the treeview CLI tool.
Feel free to submit issues, feature requests, or pull requests. PRs that add new features or improve the CLI are welcome!
MIT