Skip to content

Automatically generates and updates directory structure in README.md

License

Notifications You must be signed in to change notification settings

otthe/readme-directory-tree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

    <!-- TREEVIEW START -->
    <!-- TREEVIEW END -->
  2. Run treeview.sh via CLI or automated action

  3. You should see similar output in your README.md

    ├── 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.
    ./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

Things to consider

This script hasn't been tested on macOS.

About

Automatically generates and updates directory structure in README.md

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages