Module cli

Module cli 

Source
Expand description

CLI framework and argument parsing CLI framework module.

This module defines the CLI structure, command parsing, and global options.

§What

Provides the core CLI framework including:

  • Command-line argument definitions using Clap
  • Global options (root, log-level, format, no-color, config)
  • Command enumeration and routing
  • Argument parsing and validation

§How

Uses Clap’s derive macros to define a structured CLI with global options that apply to all commands and command-specific arguments. The framework separates concerns between:

  • CLI parsing (this module)
  • Command execution (commands module)
  • Output formatting (output module)
  • Error handling (error module)

§Why

Centralizes CLI definition for consistency, maintainability, and automatic help generation. Global options ensure consistent behavior across all commands.

§Examples

use clap::Parser;
use sublime_cli_tools::cli::Cli;

// Parse CLI arguments
let cli = Cli::parse();

// Access global options
let format = cli.format;
let log_level = cli.log_level();

Re-exports§

pub use commands::Commands;
pub use completions::generate_completions;

Modules§

branding
Branding and visual styling for the CLI.
commands
Command definitions and argument structures.
completions
Shell completion generation.

Structs§

Cli
Workspace Tools - Changeset-based version management.
OutputFormatArg
Wrapper for OutputFormat to implement Clap traits.

Enums§

LogLevel
Logging level for controlling verbosity.

Functions§

dispatch_command
Dispatches a parsed command to its handler.