Pick `main.py`/`app.py`/`index.py` if present; otherwise the first script found.
(scripts: &[PathBuf], project: &Path)
| 214 | |
| 215 | /// Pick `main.py`/`app.py`/`index.py` if present; otherwise the first script found. |
| 216 | fn 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 | |
| 230 | fn dir_size(dir: &Path) -> Result<u64> { |
| 231 | let mut total = 0u64; |