Module version

Module version 

Source
Expand description

Version command implementation.

This module implements the workspace version command that displays version information about the CLI and its dependencies.

§What

Provides the execute_version function that:

  • Displays the CLI version from Cargo.toml
  • Shows Rust compiler version used to build the binary
  • Lists internal crate dependencies and their versions
  • Shows build profile and target information
  • Supports human-readable and JSON output formats

§How

Uses compile-time environment variables set by Cargo to gather version information:

  • CARGO_PKG_VERSION for the CLI version
  • RUSTC_VERSION for the Rust compiler version (via build.rs if needed)
  • Dependency versions from Cargo.toml

The function formats output based on the requested format (Human or JSON).

§Why

Version information is critical for:

  • Troubleshooting issues (knowing exact versions)
  • Verifying installations
  • CI/CD pipelines (checking tool versions)
  • Bug reports (including version details)

§Examples

use sublime_cli_tools::commands::version::execute_version;
use sublime_cli_tools::cli::commands::VersionArgs;
use sublime_cli_tools::output::OutputFormat;
use std::path::Path;

let args = VersionArgs { verbose: false };
execute_version(&args, Path::new("."), OutputFormat::Human).await?;

Structs§

BuildInfo
Build configuration information.
DependencyVersions
Internal crate dependency versions.
VersionInfo
Version information structure for JSON output.

Functions§

execute_version
Executes the version command.