packages feed

multi-cabal-0.1.0.0: src/Main.hs

{- |
Module      :  $Header$
Description :  Entrypoint of the application.
Author      :  Nils 'bash0r' Jonsson
Copyright   :  (c) 2015 Nils 'bash0r' Jonsson
License     :  MIT

Maintainer  :  aka.bash0r@gmail.com
Stability   :  unstable
Portability :  non-portable (Portability is untested.)

The 'Main' module is the entrypoint of the application.
-}
module Main
( main
) where

import Control.Applicative
import Control.Command
import Control.Monad
import Control.Router

import System.Environment

import MultiCabal.Instruction
import MultiCabal.Commands


main :: IO ()
main = getArgs >>= invoke >> return ()
  where
    invoke []         =
      execute Help []
    invoke (cmd:args) =
      case route availableCommands cmd of
        Just a  -> execute a args
        Nothing -> putStrLn ("Command " ++ cmd ++ " is not available.\n")