Helps you to maintain your project's README by automatically providing up-to-date directory structure in a treeview format.
- Automatically generates and updates directory structure in a
README.md
file. - Configurable maximum depth for directory tree view.
- Excludes specified directories (e.g.,
node_modules
,.git
). - Easy to plug into CI.
-
Include tags in your
README.md
:<!-- TREEVIEW START --> <!-- TREEVIEW END -->
-
Run
treeview.sh
via CLI or automated action -
You should see similar output in your README.md
├── example-directory/ │ ├── build/ │ ├── scripts/ │ ├── src/ │ │ ├── backend/ │ │ │ └── server/ │ │ └── frontend/ │ │ ├── js/ │ │ └── styles/ │ └── tests/
-
treeview.sh
accepts three parameters:-
root directory: (default:
.
)
Specifies the root directory from which to generate the tree view. -
README.md path: (default:
README.md
in the current directory)
Path to theREADME.md
file where the tree view will be updated. -
maximum depth: (default:
-1
for unlimited depth)
Sets the maximum depth for directory traversal. For example:2
limits the depth to 2 levels.-1
means unlimited depth.
./treeview.sh [root_directory] [readme_path] [max_depth]
Examples:
- Generate a directory tree starting from the current directory and update the local
README.md
:./treeview.sh
- Specify a different root directory:
./treeview.sh some_directory
- Specify a different
README.md
file:./treeview.sh some_directory /path/to/another/README.md
- Limit the tree view to a maximum depth of 2:
./treeview.sh some_directory /path/to/another/README.md 2
-
This script hasn't been tested on macOS.