about summary refs log tree commit diff
path: root/services/nixcon-demo
diff options
context:
space:
mode:
Diffstat (limited to 'services/nixcon-demo')
-rw-r--r--services/nixcon-demo/src/main.rs15
1 files 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))
     })
 }