Skip to content

Commit cc305f3

Browse files
committed
formatting and fix ! command
1 parent 99c475a commit cc305f3

File tree

7 files changed

+35
-32
lines changed

7 files changed

+35
-32
lines changed

crates/chat-cli/src/cli/chat/commands/editor.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ impl Default for EditorCommand {
3939
}
4040

4141
impl EditorCommand {
42-
4342
#[allow(dead_code)]
4443
/// Get the default editor from environment or fallback to platform-specific defaults
4544
fn get_default_editor() -> String {

crates/chat-cli/src/cli/chat/commands/profile/list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,6 @@ impl CommandHandler for ListProfileCommand {
155155

156156
#[cfg(test)]
157157
mod tests {
158-
158+
159159
// Test implementations would go here
160160
}

crates/chat-cli/src/cli/chat/commands/prompts/get.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,24 +47,21 @@ impl CommandHandler for GetPromptsCommand {
4747
if args.is_empty() {
4848
return Err(ChatError::Custom("Expected prompt name".into()));
4949
}
50-
50+
5151
let name = args[0].to_string();
5252
let arguments = if args.len() > 1 {
5353
Some(args[1..].iter().map(|s| (*s).to_string()).collect())
5454
} else {
5555
None
5656
};
57-
58-
let params = crate::cli::chat::command::PromptsGetParam {
59-
name,
60-
arguments,
61-
};
62-
57+
58+
let params = crate::cli::chat::command::PromptsGetParam { name, arguments };
59+
6360
let get_command = crate::cli::chat::command::PromptsGetCommand {
6461
orig_input: Some(args.join(" ")),
6562
params,
6663
};
67-
64+
6865
Ok(Command::Prompts {
6966
subcommand: Some(PromptsSubcommand::Get { get_command }),
7067
})
@@ -94,16 +91,18 @@ impl CommandHandler for GetPromptsCommand {
9491
style::SetForegroundColor(Color::Yellow),
9592
style::Print(format!("Prompt '{}' not found.\n\n", get_command.params.name)),
9693
style::ResetColor,
97-
style::Print("To use prompts, you need to install and configure MCP servers that provide prompt templates.\n\n")
94+
style::Print(
95+
"To use prompts, you need to install and configure MCP servers that provide prompt templates.\n\n"
96+
)
9897
)?;
99-
98+
10099
if let Some(args) = &get_command.params.arguments {
101100
queue!(
102101
ctx.output,
103102
style::Print(format!("Arguments provided: {}\n\n", args.join(", ")))
104103
)?;
105104
}
106-
105+
107106
ctx.output.flush()?;
108107

109108
Ok(ChatState::PromptUser {

crates/chat-cli/src/cli/chat/commands/prompts/help.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,12 @@ impl CommandHandler for HelpPromptsCommand {
7171
style::SetAttribute(crossterm::style::Attribute::Reset),
7272
style::ResetColor,
7373
style::Print("\n"),
74-
style::Print("Prompts are reusable templates that help you quickly access common workflows and tasks.\n"),
75-
style::Print("These templates are provided by the MCP servers you have installed and configured.\n\n"),
74+
style::Print(
75+
"Prompts are reusable templates that help you quickly access common workflows and tasks.\n"
76+
),
77+
style::Print(
78+
"These templates are provided by the MCP servers you have installed and configured.\n\n"
79+
),
7680
style::SetForegroundColor(Color::Cyan),
7781
style::SetAttribute(crossterm::style::Attribute::Bold),
7882
style::Print("Available commands\n"),
@@ -108,7 +112,9 @@ impl CommandHandler for HelpPromptsCommand {
108112
style::Print("Notes\n"),
109113
style::SetAttribute(crossterm::style::Attribute::Reset),
110114
style::ResetColor,
111-
style::Print("• You can also use @<prompt name> as a shortcut for /prompts get <prompt name>\n"),
115+
style::Print(
116+
"• You can also use @<prompt name> as a shortcut for /prompts get <prompt name>\n"
117+
),
112118
style::Print("• Prompts can accept arguments to customize their behavior\n"),
113119
style::Print("• Prompts are provided by MCP servers you have installed\n\n")
114120
)?;

crates/chat-cli/src/cli/chat/commands/prompts/mod.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ Notes:
6969
• You can also use @<prompt name> as a shortcut for /prompts get <prompt name>
7070
• Prompts can accept arguments to customize their behavior
7171
• Prompts are provided by MCP servers you have installed
72-
"#.to_string()
72+
"#
73+
.to_string()
7374
}
7475

7576
fn llm_description(&self) -> String {
@@ -94,10 +95,8 @@ Available subcommands:
9495
fn to_command(&self, args: Vec<&str>) -> Result<Command, ChatError> {
9596
if args.is_empty() {
9697
// Default to showing the list when no subcommand is provided
97-
return Ok(Command::Prompts {
98-
subcommand: Some(PromptsSubcommand::List {
99-
search_word: None
100-
})
98+
return Ok(Command::Prompts {
99+
subcommand: Some(PromptsSubcommand::List { search_word: None }),
101100
});
102101
}
103102

@@ -119,24 +118,21 @@ Available subcommands:
119118
if args.len() < 2 {
120119
return Err(ChatError::Custom("Expected prompt name".into()));
121120
}
122-
121+
123122
let name = args[1].to_string();
124123
let arguments = if args.len() > 2 {
125124
Some(args[2..].iter().map(|s| (*s).to_string()).collect())
126125
} else {
127126
None
128127
};
129-
130-
let params = crate::cli::chat::command::PromptsGetParam {
131-
name,
132-
arguments,
133-
};
134-
128+
129+
let params = crate::cli::chat::command::PromptsGetParam { name, arguments };
130+
135131
let get_command = PromptsGetCommand {
136132
orig_input: Some(args[1..].join(" ")),
137133
params,
138134
};
139-
135+
140136
Some(PromptsSubcommand::Get { get_command })
141137
},
142138
"help" => {
@@ -181,7 +177,9 @@ Available subcommands:
181177
.execute_command(command, ctx, tool_uses, pending_tool_index)
182178
.await
183179
},
184-
_ => Err(ChatError::Custom("PromptsCommand can only execute Prompts commands".into())),
180+
_ => Err(ChatError::Custom(
181+
"PromptsCommand can only execute Prompts commands".into(),
182+
)),
185183
}
186184
})
187185
}

crates/chat-cli/src/cli/chat/commands/usage.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ impl Default for UsageCommand {
2929
}
3030

3131
impl UsageCommand {
32-
3332
#[allow(dead_code)]
3433
/// Format a progress bar based on percentage
3534
fn format_progress_bar(percentage: f64, width: usize) -> String {

crates/chat-cli/src/cli/chat/tool_manager.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,9 @@ impl ToolManager {
685685
"execute_bash" => Tool::ExecuteBash(serde_json::from_value::<ExecuteBash>(value.args).map_err(map_err)?),
686686
"use_aws" => Tool::UseAws(serde_json::from_value::<UseAws>(value.args).map_err(map_err)?),
687687
"report_issue" => Tool::GhIssue(serde_json::from_value::<GhIssue>(value.args).map_err(map_err)?),
688-
"internal_command" => Tool::InternalCommand(serde_json::from_value::<InternalCommand>(value.args).map_err(map_err)?),
688+
"internal_command" => {
689+
Tool::InternalCommand(serde_json::from_value::<InternalCommand>(value.args).map_err(map_err)?)
690+
},
689691
"q_think_tool" => Tool::Thinking(serde_json::from_value::<Thinking>(value.args).map_err(map_err)?),
690692
// Note that this name is namespaced with server_name{DELIMITER}tool_name
691693
name => {

0 commit comments

Comments
 (0)