BoxLang CLI Tool

🦀 DocBox 5.0+ includes a native BoxLang module with a powerful CLI tool for generating documentation directly from the command line.

πŸ“¦ Installation

DocBox can be installed as a BoxLang core module using the bx-docbox slug:

CommandBox Web Runtimes

box install bx-docbox

BoxLang OS Runtime

install-bx-module bx-docbox

Once installed, the boxlang module:docbox command becomes available for generating documentation.


🎯 Usage

boxlang module:docbox [options]

βš™οΈ Required Options

Option
Short
Description

--output-dir=<path>

-o=<path>

πŸ“ Output directory for generated docs

πŸ“‚ Source Options

Option
Description

--source=<path>

Source directory to document

--mapping=<name>

Base mapping for the source folder

--mappings:<name>=<path>

Define multiple source mappings

βš™οΈ Additional Options

Option
Short
Description

--help

-h

Show help information

--version

-v

Show version information

--excludes=<regex>

Regex pattern to exclude files/folders

--project-title=<title>

πŸ“– Project title for documentation

--theme=<name>

🎨 Theme name (default or frames)

--strategy=<class>

Documentation strategy class (default: docbox.strategy.api.HTMLAPIStrategy)


πŸ’‘ Examples

πŸ“Œ Basic Usage

Generate documentation for a single source directory:

πŸ“Œ With Project Title and Excludes

πŸ“Œ Short Form Output Directory

πŸ“Œ Multiple Source Mappings

Document multiple source directories with different mappings:

πŸ“Œ Using Frames Theme

Generate documentation with the traditional frameset layout:

πŸ“Œ JSON Array Format

Specify multiple sources using JSON array notation:

πŸ“Œ Real-World Example: ColdBox Framework


πŸ”§ Command Output

When you run the CLI tool, you'll see output like this:


πŸ†˜ Getting Help

Show Help

This displays comprehensive usage information including:

  • Command syntax

  • All available options

  • Multiple examples

  • Links to documentation

Show Version

Displays:

  • DocBox version

  • Author information

  • Website URL


⚠️ Common Issues

Missing Source Mappings

Error:

Solution: Ensure you provide either:

  • --source and --mapping together

  • One or more --mappings:<name>=<path> options

  • JSON array via --source

Missing Output Directory

Error:

Solution: Always specify where to generate documentation:

Source Directory Not Found

Warning:

Solution: Verify the source path exists and is accessible. Use absolute paths or paths relative to your current working directory.


🎨 Theme Selection

DocBox 5.0+ includes two modern themes:

Default Theme (Alpine.js SPA)

Features:

  • ⚑ Alpine.js-based SPA

  • πŸŒ“ Dark mode support

  • πŸ” Real-time search

  • πŸ“‘ Method tabs

  • πŸ’œ Modern purple design

Frames Theme (Traditional)

Features:

  • πŸ—‚οΈ Traditional frameset layout

  • πŸ“š jstree navigation

  • πŸ“± Left sidebar for packages

  • 🎯 Bootstrap 5 styling


πŸ”— Integration with Build Scripts

CommandBox Task Runner

Create a task.cfc to generate documentation:

Run with: box task run

CI/CD Pipeline

Add to your GitHub Actions, GitLab CI, or other CI/CD pipeline:


πŸ“š Next Steps

Last updated

Was this helpful?