https://github.com/otthe/readme-directory-tree
Automatically generates and updates directory structure in README.md
https://github.com/otthe/readme-directory-tree
ci readme-generator shell shell-script
Last synced: 6 months ago
JSON representation
Automatically generates and updates directory structure in README.md
- Host: GitHub
- URL: https://github.com/otthe/readme-directory-tree
- Owner: otthe
- License: mit
- Created: 2024-05-09T17:42:42.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-11T12:16:53.000Z (over 1 year ago)
- Last Synced: 2025-04-14T18:04:54.331Z (6 months ago)
- Topics: ci, readme-generator, shell, shell-script
- Language: Shell
- Homepage:
- Size: 9.77 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# readme-directory-tree
Helps you to maintain your project's README by automatically providing up-to-date directory structure in a treeview format.## Features
- 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.## Usage
1. **Include tags in your `README.md`:**
```bash
```
2. **Run `treeview.sh` via CLI or automated action**
3. **You should see similar output in your README.md**
```bash
├── example-directory/
│ ├── build/
│ ├── scripts/
│ ├── src/
│ │ ├── backend/
│ │ │ └── server/
│ │ └── frontend/
│ │ ├── js/
│ │ └── styles/
│ └── tests/
```
## Configuration
- `treeview.sh` accepts three parameters:
1. **root directory:** (default: `.`)
Specifies the root directory from which to generate the tree view.2. **README.md path:** (default: `README.md` in the current directory)
Path to the `README.md` file where the tree view will be updated.3. **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.```bash
./treeview.sh [root_directory] [readme_path] [max_depth]
```**Examples:**
- Generate a directory tree starting from the current directory and update the local `README.md`:
```bash
./treeview.sh
```
- Specify a different root directory:
```bash
./treeview.sh some_directory
```
- Specify a different `README.md` file:
```bash
./treeview.sh some_directory /path/to/another/README.md
```
- Limit the tree view to a maximum depth of 2:
```bash
./treeview.sh some_directory /path/to/another/README.md 2
```## Things to consider
This script hasn't been tested on macOS.