Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/cortex-cli/src/workspace_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -184,15 +186,15 @@ 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);
}
println!();

println!("Configuration:");
println!("{}", "-".repeat(40));
println!("{}", "-".repeat(WORKSPACE_SECTION_RULE_WIDTH));
println!(
" .cortex/config.toml: {}",
if info.has_cortex_config {
Expand All @@ -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);
}
Expand Down Expand Up @@ -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
// ==========================================================================
Expand Down