Skip to content

Commit 1ea985a

Browse files
committed
Document history default listing
1 parent 7954d02 commit 1ea985a

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

src/cortex-cli/src/agent_cmd/tests.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
#[cfg(test)]
44
mod tests {
55
use crate::agent_cmd::cli::{CopyArgs, ExportArgs};
6-
use crate::agent_cmd::loader::{
7-
load_builtin_agents, parse_frontmatter, read_file_with_encoding,
8-
};
6+
use crate::agent_cmd::loader::{load_builtin_agents, parse_frontmatter};
97
use crate::agent_cmd::types::AgentMode;
8+
use crate::utils::file::read_file_with_encoding;
109

1110
#[test]
1211
fn test_read_file_with_utf8() {

src/cortex-cli/src/cli/args.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,9 @@ pub struct ServersRefreshArgs {
805805

806806
/// History command - view past prompts and sessions.
807807
#[derive(Args)]
808+
#[command(
809+
after_help = "With no subcommand, list recent prompts. Use search to filter history or clear to delete it."
810+
)]
808811
pub struct HistoryCommand {
809812
#[command(subcommand)]
810813
pub action: Option<HistorySubcommand>,
@@ -857,7 +860,7 @@ pub struct HistoryClearArgs {
857860
#[cfg(test)]
858861
mod tests {
859862
use super::*;
860-
use clap::Parser;
863+
use clap::{CommandFactory, Parser};
861864

862865
// ==========================================================================
863866
// LogLevel tests
@@ -1782,6 +1785,18 @@ mod tests {
17821785
}
17831786
}
17841787

1788+
#[test]
1789+
fn test_history_help_documents_default_list_behavior() {
1790+
let mut cmd = Cli::command();
1791+
let help = cmd
1792+
.find_subcommand_mut("history")
1793+
.expect("history subcommand should exist")
1794+
.render_help()
1795+
.to_string();
1796+
1797+
assert!(help.contains("With no subcommand, list recent prompts."));
1798+
}
1799+
17851800
#[test]
17861801
fn test_history_command_with_limit() {
17871802
let cli = Cli::try_parse_from(["cortex", "history", "-n", "50"])

0 commit comments

Comments
 (0)