From 6681fd984f1692a6fd8f61c7e7d4427c4fd1d2f5 Mon Sep 17 00:00:00 2001 From: atagen Date: Sat, 23 Nov 2024 22:50:46 +1100 Subject: [PATCH] check for nh_flake variable --- bin/main.ml | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/bin/main.ml b/bin/main.ml index 086f4b0..3023220 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -1,13 +1,18 @@ open Meat let () = - if Array.length Sys.argv >= 2 then ( - match String.lowercase_ascii (Array.get Sys.argv 1) with - | "yum" -> yum () - | "cook" -> cook () - | "poke" -> poke () - | "gut" -> gut () - | "look" -> look () - | "fresh" -> fresh () - | _ -> help () - ) else help (); + match Sys.getenv_opt "NH_FLAKE" with + | Some _ -> + if Array.length Sys.argv >= 2 then + match String.lowercase_ascii (Array.get Sys.argv 1) with + | "yum" -> yum () + | "cook" -> cook () + | "poke" -> poke () + | "gut" -> gut () + | "look" -> look () + | "fresh" -> fresh () + | _ -> help () + else help () + | None -> + meat_print "NO PATH TO RUNESTONE FOUND!"; + help ()