MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / parse_step_options

Function parse_step_options

packages/server/src/main/batch.rs:573–600  ·  view source on GitHub ↗
(tokens: &[String])

Source from the content-addressed store, hash-verified

571}
572
573fn parse_step_options(tokens: &[String]) -> StepOptions {
574 let mut options = StepOptions::default();
575 let mut index = 0;
576 while index < tokens.len() {
577 let token = &tokens[index];
578 if let Some(stripped) = token.strip_prefix("--") {
579 if let Some((key, value)) = stripped.split_once('=') {
580 options.values.push((key.to_owned(), value.to_owned()));
581 } else if index + 1 < tokens.len() && !tokens[index + 1].starts_with("--") {
582 options
583 .values
584 .push((stripped.to_owned(), tokens[index + 1].clone()));
585 index += 1;
586 } else {
587 options.flags.push(stripped.to_owned());
588 }
589 } else if let Some(stripped) = token.strip_prefix('-') {
590 if index + 1 < tokens.len() && !tokens[index + 1].starts_with('-') {
591 options
592 .values
593 .push((stripped.to_owned(), tokens[index + 1].clone()));
594 index += 1;
595 }
596 }
597 index += 1;
598 }
599 options
600}
601
602fn required_f64(args: &StepOptions, key: &str) -> Result<f64, crate::error::AppError> {
603 args.value(key)

Callers 2

batch_line_to_json_stepFunction · 0.85
run_batch_stepFunction · 0.85

Calls 1

cloneMethod · 0.65

Tested by

no test coverage detected