GitHub Documentation Download Tool
A CLI tool to download documentation files from specific paths in GitHub repositories using tree URLs. This tool uses git sparse checkout to efficiently download only the documentation files you need from a specific directory path. Files are downloaded with a flattened directory structure, preserving only the filenames.
Features
- Direct Path Targeting: Downloads from specific GitHub tree URLs (e.g.,
/tree/main/docs
) - Git Sparse Checkout: Efficient downloads without cloning entire repositories
- Smart File Detection: Identifies documentation files by extension and common naming patterns
- Flattened Output: Downloads files directly to the output directory without preserving subdirectory structure
- List Mode: Preview files without downloading
- No Authentication Required: Works with public repositories without tokens
Installation
# Clone and build
# Or install directly
Usage
Basic Usage
# Download docs from a specific path using GitHub tree URL
# Download from documentation directory
# List files without downloading
# Download to current directory
# Specify output directory
Advanced Usage
# Download from nested documentation paths
# Control recursion
Examples
# Download Rust documentation from specific path
# All files will be placed directly in rust-docs/ without subdirectories
# Preview TanStack Router documentation
# Download React Native versioned docs to current directory
# Files like website/versioned_docs/version-0.80/view.md become ./view.md
# Download nested documentation structure - all files flattened
Supported File Types
The tool automatically detects documentation files based on:
File Extensions
- Markdown:
.md
,.markdown
- Text:
.txt
- reStructuredText:
.rst
- AsciiDoc:
.adoc
,.asciidoc
- Org-mode:
.org
- LaTeX:
.tex
- PDF:
.pdf
- HTML:
.html
,.htm
- XML:
.xml
Common Documentation Files
- README files
- CHANGELOG, CHANGES, NEWS, HISTORY
- LICENSE, COPYING
- AUTHORS, CONTRIBUTORS
- TODO, INSTALL, INSTALLATION
- USAGE, GUIDE, TUTORIAL
- FAQ, API, REFERENCE, MANUAL
Command Line Options
Options:
-r, --repo <REPO> GitHub tree URL (e.g., "https://github.com/owner/repo/tree/branch/path")
-o, --output <OUTPUT> Output directory for downloaded files [default: downloads]
--list-only Only list files without downloading
--recursive <RECURSIVE> Include subdirectories recursively [default: true]
-h, --help Print help
-V, --version Print version
URL Format
The tool expects GitHub tree URLs in this format:
https://github.com/owner/repo/tree/branch/path
Examples:
https://github.com/rust-lang/rust/tree/main/src/doc
https://github.com/TanStack/router/tree/main/docs
https://github.com/owner/repo/tree/feature-branch/documentation/api
Development
# Build the project
# Run tests
# Format code
# Run all checks
# Install locally
License
MIT License - see LICENSE file for details.