File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
crates/chat-cli/src/cli/chat Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -206,6 +206,7 @@ pub enum PromptsSubcommand {
206
206
/// List available prompts from a tool or show all available prompt
207
207
List { search_word : Option < String > } ,
208
208
Get {
209
+ #[ arg( long, hide = true ) ]
209
210
orig_input : Option < String > ,
210
211
name : String ,
211
212
arguments : Option < Vec < String > > ,
Original file line number Diff line number Diff line change @@ -119,7 +119,10 @@ use crate::cli::chat::cli::model::{
119
119
MODEL_OPTIONS ,
120
120
default_model_id,
121
121
} ;
122
- use crate :: cli:: chat:: cli:: prompts:: GetPromptError ;
122
+ use crate :: cli:: chat:: cli:: prompts:: {
123
+ GetPromptError ,
124
+ PromptsSubcommand ,
125
+ } ;
123
126
use crate :: database:: settings:: Setting ;
124
127
use crate :: mcp_client:: Prompt ;
125
128
use crate :: os:: Os ;
@@ -1234,6 +1237,24 @@ impl ChatSession {
1234
1237
Ok ( ChatState :: PromptUser {
1235
1238
skip_printing_tools : false ,
1236
1239
} )
1240
+ } else if let Some ( command) = input. strip_prefix ( "@" ) {
1241
+ let input_parts =
1242
+ shlex:: split ( command) . ok_or ( ChatError :: Custom ( "Error splitting prompt command" . into ( ) ) ) ?;
1243
+
1244
+ let mut iter = input_parts. into_iter ( ) ;
1245
+ let prompt_name = iter
1246
+ . next ( )
1247
+ . ok_or ( ChatError :: Custom ( "Prompt name needs to be specified" . into ( ) ) ) ?;
1248
+
1249
+ let args: Vec < String > = iter. collect ( ) ;
1250
+ let arguments = if args. is_empty ( ) { None } else { Some ( args) } ;
1251
+
1252
+ let subcommand = PromptsSubcommand :: Get {
1253
+ orig_input : Some ( command. to_string ( ) ) ,
1254
+ name : prompt_name,
1255
+ arguments,
1256
+ } ;
1257
+ return subcommand. execute ( self ) . await ;
1237
1258
} else if let Some ( command) = input. strip_prefix ( "!" ) {
1238
1259
// Use platform-appropriate shell
1239
1260
let result = if cfg ! ( target_os = "windows" ) {
You can’t perform that action at this time.
0 commit comments