MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / find_entry

Function find_entry

cli/src/build.rs:216–228  ·  view source on GitHub ↗

Pick `main.py`/`app.py`/`index.py` if present; otherwise the first script found.

(scripts: &[PathBuf], project: &Path)

Source from the content-addressed store, hash-verified

214
215/// Pick `main.py`/`app.py`/`index.py` if present; otherwise the first script found.
216fn find_entry(scripts: &[PathBuf], project: &Path) -> String {
217 for c in ["main.py", "app.py", "index.py"] {
218 if scripts.iter().any(|s| s.file_name().and_then(|n| n.to_str()) == Some(c)) {
219 return c.to_string();
220 }
221 }
222 scripts
223 .first()
224 .and_then(|s| s.strip_prefix(project).ok())
225 .and_then(|p| p.to_str())
226 .map(String::from)
227 .unwrap_or_else(|| "main.py".to_string())
228}
229
230fn dir_size(dir: &Path) -> Result<u64> {
231 let mut total = 0u64;

Callers 1

runFunction · 0.85

Calls 1

iterMethod · 0.45

Tested by

no test coverage detected