Stylish + 80 col

This commit is contained in:
Elliot Glaysher 2019-09-13 11:02:41 -07:00
parent 13f6d97545
commit 189f03e285
2 changed files with 24 additions and 19 deletions

View File

@ -162,20 +162,23 @@ clay pierPath king enqueueEv =
atomically $ modifyTVar (cdMountPoints cd) (M.delete desk)
-- Change the structures off of the event into something we can work with in Unix.
calculateActionHash :: FilePath -> (Path, Maybe Mime) -> (FilePath, Maybe (Mime, Int))
-- Change the structures off of the event into something we can work with
-- in Unix.
calculateActionHash :: FilePath -> (Path, Maybe Mime)
-> (FilePath, Maybe (Mime, Int))
calculateActionHash base (p, Nothing) = (base </> pathToFilePath p, Nothing)
calculateActionHash base (p, Just (Mime t f)) =
(base </> pathToFilePath p, Just ((Mime t f), (hash $ unOcts $ unFile f)))
-- Performs the actions on the actual filesystem
performAction :: (Map FilePath Int) -> (FilePath, Maybe (Mime, Int)) -> RIO e ()
performAction :: (Map FilePath Int) -> (FilePath, Maybe (Mime, Int))
-> RIO e ()
performAction m (fp, Nothing) = do
logDebug $ displayShow ("(clay) deleting file ", fp)
removeFile fp
performAction m (fp, Just ((Mime _ (File (Octs bs)), hash)))
| skip =
logDebug $ displayShow ("(clay) skipping unchanged file update " , fp)
| skip = logDebug $
displayShow ("(clay) skipping unchanged file update " , fp)
| otherwise = do
logDebug $ displayShow ("(clay) updating file " , fp)
createDirectoryIfMissing True $ takeDirectory fp
@ -203,7 +206,8 @@ clay pierPath king enqueueEv =
applySyncAction m (fp, (Just (_, h))) = M.insert fp h m
-- Changes an action list item into a form injectable into Urbit
actionsToInto :: FilePath -> (FilePath, Maybe (Mime, Int)) -> (Path, Maybe Mime)
actionsToInto :: FilePath -> (FilePath, Maybe (Mime, Int))
-> (Path, Maybe Mime)
actionsToInto prefix (fp, mybData) = (p, mybOutData)
where
p = filePathToPath strippedFp

View File

@ -1,7 +1,7 @@
module Vere.Term (initializeLocalTerminal, term, TerminalSystem(..)) where
import UrbitPrelude
import Arvo hiding (Term)
import UrbitPrelude
import Vere.Pier.Types
import Data.Char
@ -11,9 +11,9 @@ import Foreign.Storable
import System.Posix.IO
import System.Posix.Terminal
import System.Console.Terminfo.Base
import RIO.Directory (createDirectoryIfMissing)
import RIO.FilePath
import System.Console.Terminfo.Base
import Data.ByteString.Internal
@ -113,7 +113,8 @@ initializeLocalTerminal = do
io $ setTerminalAttributes stdInput newTermSettings Immediately
tsReadQueue <- newTQueueIO
pReaderThread <- asyncBound (readTerminal tsReadQueue tsWriteQueue (bell tsWriteQueue))
pReaderThread <- asyncBound
(readTerminal tsReadQueue tsWriteQueue (bell tsWriteQueue))
let tsStderr = \txt ->
atomically $ writeTQueue tsWriteQueue $ VerePrintOutput $ unpack txt