summaryrefslogtreecommitdiff
path: root/Cmd.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Cmd.hs')
-rw-r--r--Cmd.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/Cmd.hs b/Cmd.hs
index d4c617a..3e85e86 100644
--- a/Cmd.hs
+++ b/Cmd.hs
@@ -7,4 +7,10 @@ data Cmd = Cmd String String (State -> IO ())
instance Show Cmd where
show (Cmd a b _) = a ++ " - " ++ b
+cmdGet :: String -> [Cmd] -> Maybe Cmd
+cmdGet x commands =
+ let command = [ (Cmd a b c) | (Cmd a b c) <- commands, a == x ]
+ in if length command == 0
+ then Nothing
+ else Just (head command)