13 stable releases (5 major)

5.1.3 Jan 6, 2026
5.0.2 Dec 21, 2025
4.0.0 Dec 13, 2025
3.4.1 Dec 11, 2025
0.2.1 Oct 9, 2025

#1 in #ggen


Used in 2 crates

MIT license

4.5MB
89K SLoC

ggen-cli - Command-line interface for ggen code generation

This crate provides the command-line interface for ggen, using clap-noun-verb for automatic command discovery and routing. It bridges between user commands and the domain logic layer (ggen-domain).

Architecture

  • Command Discovery: Uses clap-noun-verb v3.4.0 auto-discovery to find all \[verb\] functions in the cmds module
  • Async/Sync Bridge: Provides runtime utilities to bridge async domain functions with synchronous CLI execution
  • Conventions: File-based routing conventions for template-based command generation
  • Node Integration: Programmatic entry point for Node.js addon integration

Features

  • Auto-discovery: Commands are automatically discovered via clap-noun-verb
  • Version handling: Built-in --version flag support
  • Output capture: Programmatic execution with stdout/stderr capture
  • Async support: Full async/await support for non-blocking operations

Examples

Basic CLI Execution

use ggen_cli::cli_match;

// Execute CLI with auto-discovered commands
cli_match().await?;

Programmatic Execution

use ggen_cli::run_for_node;

let args = vec!["template".to_string(), "generate".to_string()];
let result = run_for_node(args).await?;
println!("Exit code: {}", result.code);
println!("Output: {}", result.stdout);

ggen-cli-lib

CLI interface library for ggen, providing command-line argument parsing and subcommand handling.

Features

  • Command-line argument parsing with clap
  • Subcommand support for various ggen operations
  • Shell completion generation
  • Integration with the ggen core functionality
  • Marketplace v2 commands (install/search/publish/info/validate/versions/metrics/sparql/rdf_stats) powered by ggen-marketplace

Usage

This crate is primarily used internally by the main ggen binary. See the main ggen documentation for usage examples.

Dependencies

~122MB
~2M SLoC