A peer-to-peer stack for code collaboration
'rad machines create' uses daemon
Thomas Scholtesede28ae4b3f8
diff --git a/exe/Machines.hs b/exe/Machines.hsindex 7abfaef..863bea4 100644--- a/exe/Machines.hs+++ b/exe/Machines.hs@@ -5,10 +5,10 @@ module Machinesimport Protolude hiding (option)-import qualified Data.UUID as UUID-import qualified Data.UUID.V4 as UUID+import Control.Exception.Safe+import qualified Network.HTTP.Client as HttpClientimport Options.Applicative-import Radicle.Internal.MachineBackend.Ipfs+import qualified Radicle.Daemon.Client as Clientdata Command = CommandCreatederiving (Show, Eq)@@ -25,11 +25,10 @@ programParserInfo =runCommand :: Command -> IO ()runCommand CommandCreate = do- label <- UUID.toText <$> UUID.nextRandom- result <- ipfsMachineCreate label- case result of- Left err -> die (toS err)- Right machineId -> putStrLn machineId+ httpManager <- HttpClient.newManager HttpClient.defaultManagerSettings+ runExceptT (Client.newMachine httpManager) >>= \case+ Left err -> throw err+ Right (Client.MachineId machineId) -> putStrLn machineIdmain :: IO ()main = dodiff --git a/package.yaml b/package.yamlindex c1f5e28..30daf7e 100644--- a/package.yaml+++ b/package.yaml@@ -216,8 +216,9 @@ executables:other-modules: []dependencies:- radicle- - uuid+ - http-client- optparse-applicative+ - safe-exceptionsghc-options: -main-is Machinesdefault-extensions: