MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / git_subcommand_pos

Function git_subcommand_pos

src/hooks/cursor_shell.rs:264–293  ·  view source on GitHub ↗
(tokens: &[String])

Source from the content-addressed store, hash-verified

262}
263
264fn git_subcommand_pos(tokens: &[String]) -> Option<usize> {
265 if !tokens.first()?.eq_ignore_ascii_case("git") {
266 return None;
267 }
268
269 let mut i = 1;
270 while i < tokens.len() {
271 let token = tokens[i].to_ascii_lowercase();
272 match token.as_str() {
273 "-c" | "--git-dir" | "--work-tree" | "--namespace" | "--config-env" => {
274 i += 2;
275 }
276 "--" => {
277 i += 1;
278 }
279 _ if token.starts_with("--git-dir=")
280 || token.starts_with("--work-tree=")
281 || token.starts_with("--namespace=")
282 || token.starts_with("--config-env=") =>
283 {
284 i += 1;
285 }
286 _ if token.starts_with('-') => {
287 i += 1;
288 }
289 _ => return Some(i),
290 }
291 }
292 None
293}
294
295pub fn cursor_shell_command_targets_project(
296 command: &str,

Calls 1

as_strMethod · 0.45

Tested by

no test coverage detected