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_VERSIONfor the CLI versionRUSTC_VERSIONfor 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§
- Build
Info - Build configuration information.
- Dependency
Versions - Internal crate dependency versions.
- Version
Info - Version information structure for JSON output.
Functions§
- execute_
version - Executes the version command.