sim command fixes

This commit is contained in:
Joey Hess 2024-09-12 16:39:44 -04:00
parent 52891711d2
commit 2cbd3fb26b
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -27,8 +27,9 @@ seek :: CmdParams -> CommandSeek
seek ("start":[]) = start Nothing
seek ("start":simfile:[]) = start (Just simfile)
seek ("end":[]) = do
simdir <- fromRepo gitAnnexSimDir
liftIO $ removeDirectoryRecursive $ fromRawFilePath simdir
simdir <- fromRawFilePath <$> fromRepo gitAnnexSimDir
whenM (liftIO $ doesDirectoryExist simdir) $ do
liftIO $ removeDirectoryRecursive simdir
seek ("visit":reponame:[]) = do
simdir <- fromRepo gitAnnexSimDir
liftIO (restoreSim simdir) >>= \case
@ -76,7 +77,8 @@ start simfile = do
{ simFile = Just simlogfile }
case simfile of
Nothing -> startup simdir st []
Just f -> case parseSimFile f of
Just f -> liftIO (readFile f) >>= \c ->
case parseSimFile c of
Left err -> giveup err
Right cs -> startup simdir st cs
showLongNote $ UnquotedString "Sim started, logging to sim file "