execute_validate

Function execute_validate 

Source
pub async fn execute_validate(
    _args: &ConfigValidateArgs,
    output: &Output,
    root: &Path,
    config_path: Option<&Path>,
) -> Result<()>
Expand description

Execute the config validate command.

Validates the configuration file by performing comprehensive checks including:

  • File existence and parseability
  • Required fields presence
  • Field value validation (types, ranges, formats)
  • Path format validation
  • Cross-field consistency checks
  • Environment name validation
  • Registry URL validation

The command reports all validation checks and provides actionable error messages if validation fails.

§Arguments

  • _args - Command arguments (currently unused but reserved for future options)
  • output - Output handler for formatting command results
  • root - Workspace root directory
  • config_path - Optional path to config file (from global --config option)

§Returns

Returns Ok(()) if configuration is valid.

§Errors

Returns an error if:

  • The configuration file doesn’t exist
  • The configuration file cannot be parsed
  • Any validation check fails

§Examples

use sublime_cli_tools::commands::config::execute_validate;
use sublime_cli_tools::cli::commands::ConfigValidateArgs;
use sublime_cli_tools::output::{Output, OutputFormat};
use std::path::Path;

let args = ConfigValidateArgs {};
let output = Output::new(OutputFormat::Human, std::io::stdout(), false);
execute_validate(&args, &output, Path::new("."), None).await?;