mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2025-06-29 04:39:53 +00:00
move files to src folder (to allow testing) (#70)
This commit is contained in:
parent
58889be83d
commit
85727bfbf1
13 changed files with 35 additions and 41 deletions
|
@ -1,7 +1,7 @@
|
|||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module Simplex.Demo where
|
||||
module Demo where
|
||||
|
||||
import Simplex.Chat.Styled
|
||||
import System.Console.ANSI.Types
|
|
@ -5,20 +5,20 @@
|
|||
|
||||
module Main where
|
||||
|
||||
import ChatOptions
|
||||
import Control.Concurrent.STM
|
||||
import Control.Concurrent.STM (atomically)
|
||||
import Control.Logger.Simple
|
||||
import Control.Monad.IO.Unlift
|
||||
import Control.Monad.Reader
|
||||
import Simplex.Chat
|
||||
import Simplex.Chat.Controller
|
||||
import Simplex.Input
|
||||
import Simplex.Chat.Input
|
||||
import Simplex.Chat.Notification
|
||||
import Simplex.Chat.Options
|
||||
import Simplex.Chat.Store (createStore)
|
||||
import Simplex.Chat.Terminal
|
||||
import Simplex.Messaging.Agent (getSMPAgentClient)
|
||||
import Simplex.Messaging.Agent.Env.SQLite
|
||||
import Simplex.Messaging.Client (smpDefaultConfig)
|
||||
import Simplex.Notification
|
||||
import Simplex.Store (createStore)
|
||||
import Simplex.Terminal
|
||||
import System.Directory (getAppUserDataDirectory)
|
||||
import UnliftIO.Async (race_)
|
||||
|
||||
|
|
22
package.yaml
22
package.yaml
|
@ -18,11 +18,19 @@ dependencies:
|
|||
- base >= 4.7 && < 5
|
||||
- bytestring == 0.10.*
|
||||
- containers == 0.6.*
|
||||
- directory == 1.3.*
|
||||
- file-embed == 0.0.14.*
|
||||
- filepath == 1.4.*
|
||||
- mtl == 2.2.*
|
||||
- optparse-applicative == 0.15.*
|
||||
- process == 1.6.*
|
||||
- simplexmq == 0.3.*
|
||||
- sqlite-simple == 0.4.*
|
||||
- terminal == 0.2.*
|
||||
- text == 1.2.*
|
||||
- time == 1.9.*
|
||||
- unliftio == 0.2.*
|
||||
- unliftio-core == 0.2.*
|
||||
|
||||
library:
|
||||
source-dirs: src
|
||||
|
@ -33,24 +41,10 @@ executables:
|
|||
main: Main.hs
|
||||
dependencies:
|
||||
- simplex-chat
|
||||
- aeson == 1.5.*
|
||||
- async == 2.2.*
|
||||
- bytestring == 0.10.*
|
||||
- composition == 1.0.*
|
||||
- directory == 1.3.*
|
||||
- file-embed == 0.0.14.*
|
||||
- filepath == 1.4.*
|
||||
- mtl == 2.2.*
|
||||
- optparse-applicative == 0.15.*
|
||||
- process == 1.6.*
|
||||
- simple-logger == 0.1.*
|
||||
- simplexmq == 0.3.*
|
||||
- sqlite-simple == 0.4.*
|
||||
- stm == 2.5.*
|
||||
- terminal == 0.2.*
|
||||
- time == 1.9.*
|
||||
- unliftio == 0.2.*
|
||||
- unliftio-core == 0.2.*
|
||||
ghc-options:
|
||||
- -threaded
|
||||
|
||||
|
|
|
@ -27,18 +27,18 @@ import Data.Text (Text)
|
|||
import qualified Data.Text as T
|
||||
import Data.Text.Encoding (encodeUtf8)
|
||||
import Simplex.Chat.Controller
|
||||
import Simplex.Chat.Help
|
||||
import Simplex.Chat.Notification
|
||||
import Simplex.Chat.Protocol
|
||||
import Simplex.Chat.Store
|
||||
import Simplex.Chat.Styled (plain)
|
||||
import Simplex.Chat.Terminal
|
||||
import Simplex.Chat.Types
|
||||
import Simplex.Help
|
||||
import Simplex.Chat.View
|
||||
import Simplex.Messaging.Agent
|
||||
import Simplex.Messaging.Agent.Protocol
|
||||
import Simplex.Messaging.Parsers (parseAll)
|
||||
import Simplex.Messaging.Util (bshow, raceAny_)
|
||||
import Simplex.Notification
|
||||
import Simplex.Store
|
||||
import Simplex.Terminal
|
||||
import Simplex.View
|
||||
import System.Exit (exitFailure)
|
||||
import System.IO (hFlush, stdout)
|
||||
import Text.Read (readMaybe)
|
||||
|
@ -207,7 +207,7 @@ getCreateActiveUser st = do
|
|||
liftIO $ setActiveUser st (userId user)
|
||||
pure user
|
||||
selectUser users = do
|
||||
putStrLn "Select user profile: "
|
||||
putStrLn "Select user profile:"
|
||||
forM_ (zip [1 ..] users) $ \(n :: Int, user) -> putStrLn $ show n <> " - " <> userStr user
|
||||
loop
|
||||
where
|
|
@ -12,14 +12,14 @@ import Control.Monad.Except
|
|||
import Control.Monad.IO.Unlift
|
||||
import Control.Monad.Reader
|
||||
import Numeric.Natural
|
||||
import Simplex.Chat.Notification
|
||||
import Simplex.Chat.Protocol
|
||||
import Simplex.Chat.Store (StoreError)
|
||||
import Simplex.Chat.Terminal
|
||||
import Simplex.Chat.Types
|
||||
import Simplex.Messaging.Agent (AgentClient)
|
||||
import Simplex.Messaging.Agent.Protocol (AgentErrorType)
|
||||
import Simplex.Messaging.Agent.Store.SQLite (SQLiteStore)
|
||||
import Simplex.Notification
|
||||
import Simplex.Store (StoreError)
|
||||
import Simplex.Terminal
|
||||
import UnliftIO.STM
|
||||
|
||||
data ChatController = ChatController
|
|
@ -1,6 +1,6 @@
|
|||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module Simplex.Help where
|
||||
module Simplex.Chat.Help where
|
||||
|
||||
import Data.List (intersperse)
|
||||
import Simplex.Chat.Markdown
|
|
@ -2,14 +2,14 @@
|
|||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE NamedFieldPuns #-}
|
||||
|
||||
module Simplex.Input where
|
||||
module Simplex.Chat.Input where
|
||||
|
||||
import Control.Monad.IO.Unlift
|
||||
import Control.Monad.Reader
|
||||
import Data.List (dropWhileEnd)
|
||||
import qualified Data.Text as T
|
||||
import Simplex.Chat.Controller
|
||||
import Simplex.Terminal
|
||||
import Simplex.Chat.Terminal
|
||||
import System.Exit (exitSuccess)
|
||||
import System.Terminal hiding (insertChars)
|
||||
import UnliftIO.STM
|
|
@ -2,7 +2,7 @@
|
|||
{-# LANGUAGE NamedFieldPuns #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module Simplex.Notification (Notification (..), initializeNotifications) where
|
||||
module Simplex.Chat.Notification (Notification (..), initializeNotifications) where
|
||||
|
||||
import Control.Monad (void)
|
||||
import Data.Char (toLower)
|
|
@ -1,6 +1,6 @@
|
|||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module ChatOptions (getChatOpts, ChatOpts (..)) where
|
||||
module Simplex.Chat.Options (getChatOpts, ChatOpts (..)) where
|
||||
|
||||
import qualified Data.Attoparsec.ByteString.Char8 as A
|
||||
import qualified Data.ByteString.Char8 as B
|
|
@ -9,7 +9,7 @@
|
|||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Simplex.Store
|
||||
module Simplex.Chat.Store
|
||||
( SQLiteStore,
|
||||
StoreError (..),
|
||||
createStore,
|
|
@ -2,7 +2,7 @@
|
|||
{-# LANGUAGE NamedFieldPuns #-}
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
|
||||
module Simplex.Terminal where
|
||||
module Simplex.Chat.Terminal where
|
||||
|
||||
import Simplex.Chat.Styled
|
||||
import Simplex.Chat.Types
|
|
@ -1,4 +1,4 @@
|
|||
module Simplex.Util where
|
||||
module Simplex.Chat.Util where
|
||||
|
||||
import Data.ByteString.Char8 (ByteString)
|
||||
import Data.Text (Text)
|
|
@ -3,7 +3,7 @@
|
|||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module Simplex.View
|
||||
module Simplex.Chat.View
|
||||
( printToView,
|
||||
showInvitation,
|
||||
showChatError,
|
||||
|
@ -27,10 +27,10 @@ import Data.Time.LocalTime (TimeZone, ZonedTime, getCurrentTimeZone, getZonedTim
|
|||
import Simplex.Chat.Controller
|
||||
import Simplex.Chat.Markdown
|
||||
import Simplex.Chat.Styled
|
||||
import Simplex.Chat.Terminal (printToTerminal)
|
||||
import Simplex.Chat.Types
|
||||
import Simplex.Chat.Util (safeDecodeUtf8)
|
||||
import Simplex.Messaging.Agent.Protocol
|
||||
import Simplex.Terminal (printToTerminal)
|
||||
import Simplex.Util (safeDecodeUtf8)
|
||||
import System.Console.ANSI.Types
|
||||
|
||||
type ChatReader m = (MonadUnliftIO m, MonadReader ChatController m)
|
Loading…
Add table
Add a link
Reference in a new issue