diff options
| author | LLLL Colonq <llll@colonq> | 2026-08-07 02:14:16 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2026-08-07 02:14:16 -0400 |
| commit | c35b9c655f0da9da706d4f7194db62e5b0521fde (patch) | |
| tree | 0fff29065b95d17139ffab5523bf82879362f807 | |
| parent | ee4b068359137edaa5ce6ce6a4e7e880dd65fe03 (diff) | |
Add game-url option
| -rw-r--r-- | 2026/src/main.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/2026/src/main.rs b/2026/src/main.rs index 07adb93..e94cc98 100644 --- a/2026/src/main.rs +++ b/2026/src/main.rs @@ -38,10 +38,14 @@ pub async fn main() { let matches = command!() .propagate_version(true) .arg(Arg::new("no-browser").help("Don't start the user's web browser").long("no-browser").action(ArgAction::SetTrue)) + .arg(Arg::new("game-url").help("URL to prepend to game paths.").long("game-url")) .get_matches(); + let prefix = if let Some(url) = matches.get_one::<String>("game-url") { + url.to_owned() + } else { "".to_owned() }; let games: Vec<String> = std::fs::read_dir("games") .expect("games directory does not exist!") - .filter_map(|g| g.ok().map(|h| format!("games/{}/index.html", h.file_name().display()))) + .filter_map(|g| g.ok().map(|h| format!("{}/games/{}/index.html", prefix, h.file_name().display()))) .collect(); let app = axum::Router::new() .route("/", axum::routing::get(move || async { |
