MCPcopy Create free account
hub / github.com/cargo-lambda/cargo-lambda / run

Function run

crates/cargo-lambda-system/src/lib.rs:81–116  ·  view source on GitHub ↗
(config: &System, options: &ConfigOptions)

Source from the content-addressed store, hash-verified

79
80#[tracing::instrument(target = "cargo_lambda")]
81pub async fn run(config: &System, options: &ConfigOptions) -> Result<()> {
82 trace!("running config command");
83
84 if config.setup {
85 let zig_info = check_installation().await?;
86 return print_config(config.output_format.as_ref(), zig_info);
87 }
88
89 let mut info = Info {
90 zig: get_zig_info()?,
91 config: None,
92 };
93 let manifest_path = config.manifest_path();
94
95 if manifest_path.exists() {
96 let metadata = load_metadata(manifest_path, None)?;
97
98 let config_info = if !options.names.is_empty() || metadata.packages.len() == 1 {
99 let config = load_config_without_cli_flags(&metadata, options)?;
100 ConfigInfo::Package(config)
101 } else {
102 let (_, _, workspace) = general_config_figment(&metadata, options)?;
103
104 let packages = get_config_from_all_packages(&metadata)?;
105
106 ConfigInfo::Global {
107 workspace: workspace.extract().into_diagnostic()?,
108 packages,
109 }
110 };
111
112 info.config = Some(config_info);
113 }
114
115 print_config(config.output_format.as_ref(), info)
116}
117
118fn print_config(format: Option<&OutputFormat>, info: impl Serialize) -> Result<()> {
119 match format {

Callers

nothing calls this directly

Calls 9

check_installationFunction · 0.85
print_configFunction · 0.85
get_zig_infoFunction · 0.85
load_metadataFunction · 0.85
general_config_figmentFunction · 0.85
manifest_pathMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected