Skip to content
Draft
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ set "OPENVIKING_CONFIG_FILE=%USERPROFILE%\.openviking\ov.conf"

#### CLI/Client Configuration Examples

You can initialize the configuration of the CLI/client interactively through the `ov config setup-cli` command. If you have multiple openviking servers, you can also switch to other configurations using the `ov config switch` command.
You can initialize the configuration of the CLI/client interactively through the `ov config` command. If you have multiple openviking servers, you can also switch to other configurations using the `ov config switch` command.

👇 Expand to see the configuration example for your CLI/Client:
<details>
Expand Down
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ set "OPENVIKING_CONFIG_FILE=%USERPROFILE%\.openviking\ov.conf"

#### CLI/客户端配置示例

你可以通过 `ov config setup-cli` 命令来以交互式方式初始化 CLI/客户端的配置。如果你有多个 openviking 服务器,你还可以通过 `ov config switch` 命令来切换到其他配置。
你可以通过 `ov config` 命令来以交互式方式初始化 CLI/客户端的配置。如果你有多个 openviking 服务器,你还可以通过 `ov config switch` 命令来切换到其他配置。

👇 展开查看您的 CLI/客户端的配置示例:

Expand Down
57 changes: 46 additions & 11 deletions crates/ov_cli/src/commands/system.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use crate::client::HttpClient;
use crate::config::Config;
use crate::error::Result;
use crate::health_ui;
use crate::output::{OutputFormat, output_success};
use crate::status_ui;
use serde_json::json;

pub async fn wait(
Expand All @@ -26,6 +29,46 @@ pub async fn status(client: &HttpClient, output_format: OutputFormat, compact: b
Ok(())
}

pub async fn diagnostic_status(
client: &HttpClient,
config: &Config,
output_format: OutputFormat,
compact: bool,
verbose: bool,
) -> Result<()> {
let meta = status_ui::current_config_meta();

if matches!(output_format, OutputFormat::Json) || verbose {
let response: serde_json::Value = client.get("/api/v1/observer/system", &[]).await?;
output_success(&response, output_format, compact);
return Ok(());
}

match client
.get::<serde_json::Value>("/api/v1/observer/system", &[])
.await
{
Ok(response) => {
print!(
"{}",
status_ui::render_status(&response, config, meta.active_name.as_deref(),)?
);
}
Err(_) => {
print!(
"{}",
status_ui::render_unreachable_status(
config,
meta.active_name.as_deref(),
meta.saved_count,
)
);
}
}

Ok(())
}

pub async fn consistency(
client: &HttpClient,
uri: &str,
Expand Down Expand Up @@ -70,6 +113,7 @@ fn output_consistency_table(response: &serde_json::Value, compact: bool) {

pub async fn health(
client: &HttpClient,
config: Option<&Config>,
output_format: OutputFormat,
compact: bool,
) -> Result<bool> {
Expand All @@ -81,19 +125,10 @@ pub async fn health(
.and_then(|v| v.as_bool())
.unwrap_or(false);

// For table output, print in a readable format
if matches!(output_format, OutputFormat::Table) || matches!(output_format, OutputFormat::Json) {
if matches!(output_format, OutputFormat::Json) {
output_success(&response, output_format, compact);
} else {
// Simple text output - print healthy first, then other fields line by line
println!("healthy {}", if healthy { "true" } else { "false" });
if let Some(obj) = response.as_object() {
for (key, value) in obj {
if key != "healthy" {
println!("{} {}", key, value);
}
}
}
print!("{}", health_ui::render_health(&response, config));
}

Ok(healthy)
Expand Down
Loading
Loading