From 58d10d3e607bafe881449d3ae3f23b4bcb24aa6e Mon Sep 17 00:00:00 2001 From: wuyangji <694410194@qq.com> Date: Thu, 14 May 2026 13:32:39 +0800 Subject: [PATCH] =?UTF-8?q?fix(cli):=20=E7=BB=9F=E4=B8=80=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E5=8C=BA=E8=A7=86=E5=9B=BE=E5=88=86=E9=9A=94=E7=BA=BF?= =?UTF-8?q?=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cortex-cli/src/workspace_cmd.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/cortex-cli/src/workspace_cmd.rs b/src/cortex-cli/src/workspace_cmd.rs index 1e716c458..4a5522191 100644 --- a/src/cortex-cli/src/workspace_cmd.rs +++ b/src/cortex-cli/src/workspace_cmd.rs @@ -10,6 +10,8 @@ use clap::Parser; use serde::{Deserialize, Serialize}; use std::path::PathBuf; +const WORKSPACE_SECTION_RULE_WIDTH: usize = 50; + /// Workspace CLI command. #[derive(Debug, Parser)] pub struct WorkspaceCli { @@ -184,7 +186,7 @@ async fn run_show(args: WorkspaceShowArgs) -> Result<()> { } println!("Workspace Information"); - println!("{}", "=".repeat(50)); + println!("{}", "=".repeat(WORKSPACE_SECTION_RULE_WIDTH)); println!(" Root: {}", info.root.display()); if let Some(ref name) = info.project_name { println!(" Project: {}", name); @@ -192,7 +194,7 @@ async fn run_show(args: WorkspaceShowArgs) -> Result<()> { println!(); println!("Configuration:"); - println!("{}", "-".repeat(40)); + println!("{}", "-".repeat(WORKSPACE_SECTION_RULE_WIDTH)); println!( " .cortex/config.toml: {}", if info.has_cortex_config { @@ -217,7 +219,7 @@ async fn run_show(args: WorkspaceShowArgs) -> Result<()> { if let Some(ref settings) = info.settings { println!(); println!("Workspace Settings:"); - println!("{}", "-".repeat(40)); + println!("{}", "-".repeat(WORKSPACE_SECTION_RULE_WIDTH)); if let Some(ref model) = settings.model { println!(" Model: {}", model); } @@ -628,6 +630,13 @@ mod tests { assert!(args.json); } + #[test] + fn test_workspace_show_rule_width_is_consistent() { + assert_eq!(WORKSPACE_SECTION_RULE_WIDTH, 50); + assert_eq!("=".repeat(WORKSPACE_SECTION_RULE_WIDTH).len(), 50); + assert_eq!("-".repeat(WORKSPACE_SECTION_RULE_WIDTH).len(), 50); + } + // ========================================================================== // WorkspaceInitArgs tests // ==========================================================================