MCPcopy Create free account
hub / github.com/GCWing/BitFun / handle_command

Method handle_command

src/apps/cli/src/ui/startup.rs:1100–1168  ·  view source on GitHub ↗
(&mut self, command: &str)

Source from the content-addressed store, hash-verified

1098 // ======================== Command execution ========================
1099
1100 fn handle_command(&mut self, command: &str) -> Option<StartupResult> {
1101 let cmd = command.split_whitespace().next().unwrap_or("");
1102
1103 self.text_input.clear();
1104 self.refresh_command_menu();
1105
1106 match cmd {
1107 "/help" => {
1108 self.info_popup = Some(KEYBOARD_SHORTCUTS_HELP.to_string());
1109 }
1110 "/exit" => {
1111 return Some(StartupResult::Exit);
1112 }
1113 "/sessions" => {
1114 self.show_session_selector();
1115 }
1116 "/models" => {
1117 self.show_model_selector();
1118 }
1119 "/theme" => {
1120 self.show_theme_selector();
1121 }
1122 "/connect" => {
1123 self.push_current_popup_to_stack();
1124 self.provider_selector.show();
1125 }
1126 "/agents" => {
1127 self.show_agent_selector();
1128 }
1129 "/skills" => {
1130 self.show_skill_selector();
1131 }
1132 "/subagents" => {
1133 self.show_subagent_selector();
1134 }
1135 "/mcps" => {
1136 // Enter chat mode and auto-trigger /mcps command
1137 return Some(StartupResult::NewSession {
1138 prompt: Some("/mcps".to_string()),
1139 });
1140 }
1141 "/acp" => {
1142 return Some(StartupResult::NewSession {
1143 prompt: Some("/acp".to_string()),
1144 });
1145 }
1146 "/usage" => {
1147 self.status = Some("No active session for /usage.".to_string());
1148 }
1149 "/init" => match crate::prompts::get_cli_prompt("init") {
1150 Some(prompt) => {
1151 return Some(StartupResult::NewSession {
1152 prompt: Some(prompt.to_string()),
1153 });
1154 }
1155 None => {
1156 self.status = Some("Init prompt not found".to_string());
1157 }

Callers 1

handle_keyMethod · 0.45

Calls 11

nextMethod · 0.80
clearMethod · 0.45
refresh_command_menuMethod · 0.45
show_session_selectorMethod · 0.45
show_model_selectorMethod · 0.45
show_theme_selectorMethod · 0.45
showMethod · 0.45
show_agent_selectorMethod · 0.45
show_skill_selectorMethod · 0.45

Tested by

no test coverage detected