ca-store is planned to work as follows: 1) A monad (currently IO) will generate the configuration, read the command line, parse the config files, and create the environment the program should run in. 2) This environment will be passed to the main monad (currently Program) to do the work. Currently everything will be directly coded with little to no abstraction. Once ca-store is up and running, we will begin regaining purity by pulling major features into small testable units.
24 lines
599 B
Haskell
24 lines
599 B
Haskell
{-|
|
|
Module: CAStore.Config.CLI
|
|
Description: Processes the command line of ca-store
|
|
-}
|
|
|
|
module CAStore.Config.CLI
|
|
( parseCLI
|
|
)
|
|
where
|
|
|
|
import CAStore.Config.Type (Config(..))
|
|
import CAStore.Type
|
|
import Data.Functor.Barbie (bsequence')
|
|
import Data.Functor.Identity (Identity(..))
|
|
import Options.Applicative hiding (command)
|
|
|
|
parseCLI :: IO (Config Identity)
|
|
parseCLI = execParser $ info (bsequence' parser) mempty
|
|
|
|
parser :: Config Parser
|
|
parser = Config
|
|
{ storeLocation = argument (maybeReader parseStoreLocation) (metavar "STORE")
|
|
, arguments = some (strArgument (metavar "COMMAND"))
|
|
}
|