MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / module_specific_cli_flags

Method module_specific_cli_flags

crates/cli/src/spacetime_config.rs:467–480  ·  view source on GitHub ↗

Get user-facing CLI flags (e.g. `--bin-path`) for all module-specific options that were explicitly provided via CLI.

(&self, command: &Command, matches: &ArgMatches)

Source from the content-addressed store, hash-verified

465 /// Get user-facing CLI flags (e.g. `--bin-path`) for all module-specific options
466 /// that were explicitly provided via CLI.
467 pub fn module_specific_cli_flags(&self, command: &Command, matches: &ArgMatches) -> Vec<String> {
468 self.module_specific_cli_args(matches)
469 .iter()
470 .map(|arg| {
471 let clap_name = self.clap_arg_name_for(arg);
472 command
473 .get_arguments()
474 .find(|a| a.get_id().as_str() == clap_name)
475 .and_then(|a| a.get_long())
476 .map(|long| format!("--{long}"))
477 .unwrap_or_else(|| format!("--{}", clap_name.replace('_', "-")))
478 })
479 .collect()
480 }
481
482 /// Validate that module-specific CLI flags are not used when operating on multiple targets.
483 pub fn validate_no_module_specific_cli_args_for_multiple_targets(

Calls 7

clap_arg_name_forMethod · 0.80
iterMethod · 0.65
collectMethod · 0.45
mapMethod · 0.45
findMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected