diff options
| author | LLLL Colonq <llll@colonq> | 2026-06-18 18:07:08 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2026-06-18 18:07:08 -0400 |
| commit | 47036ba678949ade21ecbecaeb780b324f6ce3ee (patch) | |
| tree | 28d87c88634df74bbecb8b761d65e55670b22b99 /2026/src | |
| parent | c9fc2ca532c5219a087924ece1e38be19c25f006 (diff) | |
Fix harness
Diffstat (limited to '2026/src')
| -rw-r--r-- | 2026/src/main.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/2026/src/main.rs b/2026/src/main.rs index c7796f3..ad37e4a 100644 --- a/2026/src/main.rs +++ b/2026/src/main.rs @@ -1,5 +1,6 @@ use axum::http::StatusCode; use tower_http::services::ServeDir; +use clap::{command, Arg, ArgAction}; static FRAMING: include_dir::Dir<'_> = include_dir::include_dir!("framing/dist"); @@ -33,6 +34,10 @@ async fn handle_get_framing( #[tokio::main] 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)) + .get_matches(); 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()))) @@ -53,6 +58,8 @@ pub async fn main() { let listener = tokio::net::TcpListener::bind("127.0.0.1:8081").await.expect("failed to open server socket"); println!("starting server on port 8081!"); let server = axum::serve(listener, app); - let _ = webbrowser::open("http://localhost:8081"); + if !matches.get_flag("no-browser") { + let _ = webbrowser::open("http://localhost:8081"); + } server.await.expect("failed to run server"); } |
