From b40650cd6bde21d781d0737d654f0d3aaa85f6d8 Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Thu, 5 Dec 2024 09:15:49 -0500 Subject: [PATCH] feat: allow solution ID to be passed as CLI arg --- src/Main.idr | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Main.idr b/src/Main.idr index 5235a47..1902a56 100644 --- a/src/Main.idr +++ b/src/Main.idr @@ -3,6 +3,7 @@ module Main import Data.SortedMap import Data.Problem import Language.Reflection +import System import AllDays @@ -30,11 +31,13 @@ getInput = go "" main : IO () main = do - putStr "Solution: " - Just pr <- parseProblem <$> getLine - | Nothing => putStrLn "Invalid solution ID" - let Just func = lookup pr solMap - | Nothing => putStrLn "This part is not implemented yet!" + sol <- case !getArgs of + [_, s] => pure s + _ => putStr "Solution: " >> getLine + let Just pr = parseProblem sol + | Nothing => putStrLn "ERROR: Invalid solution" + Just func = lookup pr solMap + | Nothing => putStrLn "ERROR: This part is not implemented yet!" putStrLn "Input (end with \\):" input <- trim <$> getInput