Skip to content

Commit

Permalink
Added using SGR scope
Browse files Browse the repository at this point in the history
  • Loading branch information
TimeTravelPenguin committed Nov 7, 2023
1 parent 5d690e4 commit 943397e
Showing 1 changed file with 10 additions and 24 deletions.
34 changes: 10 additions & 24 deletions src/Commands.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@

module Commands (runProgram) where

import Actions.CourseDirectory (createNewAssessmentInLocation, getCourseDirectoryAt, getCourseDirectoryInPath)
import Control.Lens
import Actions.CourseDirectory ( createNewAssessmentInLocation )
import Control.Monad.Reader (MonadIO (liftIO), ReaderT)
import Control.Monad.Trans.Maybe (MaybeT (..))
import Data.Configuration (CopyConfiguration)
import Options (AppArgs (AppArgs), AssessmentCopyToLocation, ProgramCommand (CreateAssessment, GradingCLI), ProgramOptions (ProgramOptions), getProgramOptions)
import Options.Applicative (ParserInfo, execParser, fullDesc, header, helper, info, progDesc, (<**>))
import Path (Abs, Dir, Path)
import Path.IO (AnyPath (makeAbsolute), getCurrentDir)
import Text.Pretty.Simple (pPrint)
import Printing (putHyperlink, sgrYellow, startSGRScope)
import StringFormatters (cleanAbsDirPathString)

type CopyConfigReader = ReaderT CopyConfiguration IO

-- | TODO: Need to implement configuration logics
runProgram :: CopyConfiguration -> IO ()
runProgram copyConfig = do

Check warning on line 17 in src/Commands.hs

View workflow job for this annotation

GitHub Actions / GHC 9.6 on ubuntu-latest

Defined but not used: ‘copyConfig’

Check warning on line 17 in src/Commands.hs

View workflow job for this annotation

GitHub Actions / GHC 9.6 on windows-latest

Defined but not used: ‘copyConfig’

Check warning on line 17 in src/Commands.hs

View workflow job for this annotation

GitHub Actions / GHC 9.6 on macos-latest

Defined but not used: ‘copyConfig’
(ProgramOptions (AppArgs command) cwd) <- getProgramOptions
Expand All @@ -27,21 +25,9 @@ newAssessmentInLocation loc dir = do
newAssess <- createNewAssessmentInLocation loc dir
case newAssess of
Nothing -> putStrLn "There was an error creating a new assessment..."
Just assess -> liftIO $ putStrLn $ unwords ["Assessment created in:", show assess]

-- TODO: This version is a WIP
{- createNewAssessment loc dir = do
courseDir <- case loc of
Here -> dir
NewCourseAssessment -> getCourseDirectoryAt dir
ensureAssessmentsRoot (configuration ^. courseAssessmentsDirectoryRoot)
createAssessmentCommand :: CopyTemplateItemName -> CopyConfigReader ()
createAssessmentCommand templateName = do
return () -}

{- copyAssessmentTemplateCommand :: CopyTemplateItemName -> CopyConfigReader ()
copyAssessmentTemplateCommand templateName = do
config <- ask
let template = config ^. copyTemplateItems
return () -}
Just assess -> do
let assessStr = cleanAbsDirPathString assess
startSGRScope sgrYellow $ do
liftIO $ putStr "Assessment created in: \""
putHyperlink assessStr assessStr
liftIO $ putStrLn "\".\n"

0 comments on commit 943397e

Please sign in to comment.