From 161f1b5e85899446753bce465579aaee366be780 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 26 Oct 2019 13:50:42 +0200 Subject: feat(nixcon-demo): Add CLI mode for NixCon demo Maybe a bit more sane than trying to do a network based setup. --- services/nixcon-demo/src/main.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/services/nixcon-demo/src/main.rs b/services/nixcon-demo/src/main.rs index c05124aaa3d8..226fe49ed1a3 100644 --- a/services/nixcon-demo/src/main.rs +++ b/services/nixcon-demo/src/main.rs @@ -1,8 +1,19 @@ -use std::io; use rouille::Response; +use std::env; +use std::io; +use std::process; + +const GREETING: &str = "Haló NixCon!"; fn main() { + if let Some(arg) = env::args().last() { + if arg == "--cli" { + println!("{}", GREETING); + process::exit(0); + } + } + rouille::start_server("0.0.0.0:8080", move |req| { - rouille::log(req, io::stdout(), || Response::text("Haló NixCon!")) + rouille::log(req, io::stdout(), || Response::text(GREETING)) }) } -- cgit 1.4.1