aboutsummaryrefslogtreecommitdiff
path: root/src/cli
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-08-14 04:22:48 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-08-14 04:22:48 +0300
commit1af1a5b86f642ae7b053037bc472913cfbc1e206 (patch)
tree9b2826f592bcaa5420149d9e9752a79ec9ed9d30 /src/cli
parent1ac5e9805784e14a5322a0e60e435348149721ee (diff)
feat(cli): guide agents to Herdr resources
Diffstat (limited to 'src/cli')
-rw-r--r--src/cli/spec.rs30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/cli/spec.rs b/src/cli/spec.rs
index ba454bfc..b2b6cb03 100644
--- a/src/cli/spec.rs
+++ b/src/cli/spec.rs
@@ -43,18 +43,23 @@ pub(super) fn command() -> Command {
.subcommand(session_command())
.subcommand(integration_command())
.subcommand(plugin_command());
- configure_help(command, true)
+ configure_help(command, 0)
}
-fn configure_help(command: Command, root: bool) -> Command {
- let command = if root {
+fn configure_help(command: Command, depth: usize) -> Command {
+ let command = if depth == 0 {
command
} else {
command.disable_help_flag(false)
};
+ let command = if depth == 1 && command.has_subcommands() {
+ command.after_help(super::AGENT_HELP_FOOTER)
+ } else {
+ command
+ };
command
.disable_help_subcommand(true)
- .mut_subcommands(|subcommand| configure_help(subcommand, false))
+ .mut_subcommands(|subcommand| configure_help(subcommand, depth + 1))
}
pub(super) fn print_requested_help(args: &[String]) -> std::io::Result<bool> {
@@ -1307,6 +1312,23 @@ mod tests {
}
#[test]
+ fn agent_resources_appear_on_command_groups_but_not_leaf_commands() {
+ for group in ["agent", "pane", "workspace", "terminal"] {
+ let help = long_help(&[group]);
+ assert!(
+ help.contains(super::super::AGENT_HELP_FOOTER),
+ "herdr {group} is missing agent resources: {help}"
+ );
+ }
+
+ let leaf = long_help(&["agent", "wait"]);
+ assert!(
+ !leaf.contains(super::super::AGENT_HELP_FOOTER),
+ "leaf help should stay focused: {leaf}"
+ );
+ }
+
+ #[test]
fn next_step_hints_render_without_replacing_existing_after_help() {
let agent_start = long_help(&["agent", "start"]);
assert!(