MCPcopy Create free account
hub / github.com/base/base / execute

Method execute

acceptance/src/cli.rs:167–246  ·  view source on GitHub ↗

Executes the parsed command and returns the stable process code.

(self)

Source from the content-addressed store, hash-verified

165impl AcceptanceCli {
166 /// Executes the parsed command and returns the stable process code.
167 pub async fn execute(self) -> Result<ExitCode> {
168 match self.command {
169 AcceptanceCommand::Validate { paths } => {
170 CliRun::load_all(&paths)?;
171 Ok(ExitCode::Passed)
172 }
173 AcceptanceCommand::Plan { paths } => {
174 println!("{}", serde_json::to_string_pretty(&CliRun::load_all(&paths)?)?);
175 Ok(ExitCode::Passed)
176 }
177 AcceptanceCommand::Manifest { paths, run_id, tested_sha, output } => {
178 let scenarios = CliRun::load_all(&paths)?
179 .into_iter()
180 .map(|scenario| ExpectedScenario {
181 id: scenario.id,
182 checks: scenario.checks.iter().map(|check| check.id().into()).collect(),
183 })
184 .collect();
185 let manifest =
186 ExpectedManifest { schema_version: 1, run_id, tested_sha, scenarios };
187 fs::write(output, format!("{}\n", serde_json::to_string_pretty(&manifest)?))?;
188 Ok(ExitCode::Passed)
189 }
190 AcceptanceCommand::Run { path, output, no_build, run_id, tested_sha, repo_root } => {
191 let root = CliRun::resolve_repo(repo_root.as_deref().or_else(|| path.parent()))?;
192 CliRun {
193 path,
194 output,
195 run_id,
196 tested_sha,
197 repo_root: root,
198 endpoints: None,
199 endpoint_file: None,
200 rollup: None,
201 build: !no_build,
202 }
203 .execute()
204 .await
205 }
206 AcceptanceCommand::Check { path, endpoints, rollup, output, run_id, tested_sha } => {
207 let endpoint_file = endpoints.clone();
208 let bytes = fs::read(&endpoints).wrap_err("read endpoint map")?;
209 let endpoints: BTreeMap<String, String> =
210 serde_json::from_slice(&bytes).wrap_err("parse endpoint map")?;
211 let root = CliRun::resolve_repo(path.parent())?;
212 CliRun {
213 path,
214 output,
215 run_id,
216 tested_sha,
217 repo_root: root,
218 endpoints: Some(endpoints),
219 endpoint_file: Some(endpoint_file),
220 rollup,
221 build: false,
222 }
223 .execute()
224 .await

Callers 5

runMethod · 0.45
runMethod · 0.45
runMethod · 0.45
mainFunction · 0.45

Calls 15

is_someMethod · 0.80
runFunction · 0.70
readFunction · 0.50
collectMethod · 0.45
into_iterMethod · 0.45
iterMethod · 0.45
idMethod · 0.45
parentMethod · 0.45
cloneMethod · 0.45
existsMethod · 0.45
lenMethod · 0.45
nextMethod · 0.45