print init instructions

This commit is contained in:
Filip Gralinski 2015-08-23 08:54:08 +02:00 committed by Filip Gralinski
parent 210e7b9cc8
commit 0892b8b0a3
2 changed files with 20 additions and 1 deletions

View File

@ -24,6 +24,7 @@ library
, conduit-extra , conduit-extra
, directory , directory
, filepath , filepath
, here
, optparse-applicative , optparse-applicative
, resourcet , resourcet
, text , text

View File

@ -1,3 +1,5 @@
{-# LANGUAGE QuasiQuotes #-}
module GEval.OptionsParser module GEval.OptionsParser
(fullOptionsParser, (fullOptionsParser,
runGEval) where runGEval) where
@ -5,8 +7,10 @@ module GEval.OptionsParser
import Options.Applicative import Options.Applicative
import qualified System.Directory as D import qualified System.Directory as D
import System.FilePath import System.FilePath
import System.Exit
import Data.Maybe import Data.Maybe
import System.IO import System.IO
import Data.String.Here
import GEval.Core import GEval.Core
@ -102,4 +106,18 @@ runGEval''' False spec = do
return $ Just val return $ Just val
initChallange :: GEvalSpecification -> IO () initChallange :: GEvalSpecification -> IO ()
initChallange spec = print "will init a challange" initChallange spec = case gesExpectedDirectory spec of
Nothing -> showInitInstructions
Just expectedDirectory -> initChallange' expectedDirectory spec
initChallange' :: FilePath -> GEvalSpecification -> IO ()
initChallange' expectedDirectory spec = putStrLn "init running..."
showInitInstructions = do
putStrLn [here|
Run:
geval --init --expected-directory CHALLANGE
to create a directory CHALLANGE representing a Gonito challange.
(Note that `--out-directory` option is not taken into account with `--init` option.)
|]
exitFailure