packages feed

console-program-0.2.0.0: Examples/Simple.hs

module Simple where


import Data.Tree (Tree(Node))

import           System.Console.Command (Commands,Command(..),execute)
import           System.Console.Action  (simple)


myCommands :: Commands () -- We need no configuration, so we use '()'.
myCommands = Node
  (Command "say" [] [] "" . simple $ putStrLn "No command given.")
  [
    Node
      (Command "yes" [] [] "" . simple $ putStrLn "Yes!")
      []
  , Node
      (Command "no" [] [] "" . simple $ putStrLn "No!")
      []
  ]

main :: IO ()
main = execute () myCommands