修复错误,优化性能,实现类型系统,优化安装卸载过程
This commit is contained in:
1 parent
fd5f320360
commit
48eec484b7
104 files changed
+4127
-845
No files matched your search
@@ -0,0 +1,21 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module ChuSQL.CLI.History (historySettings, rememberStatement) where
|
||||
|
||||
import Control.Monad (unless)
|
||||
import Control.Monad.IO.Class (MonadIO)
|
||||
import qualified Data.Text as T
|
||||
import System.Console.Haskeline (InputT, Settings (..), defaultSettings, modifyHistory)
|
||||
import System.Console.Haskeline.History (addHistory)
|
||||
|
||||
-- 关闭逐行历史,筛选完整语句后记录安全输入。
|
||||
|
||||
-- | 配置仅手动追加的输入历史
|
||||
historySettings :: MonadIO m => Maybe FilePath -> Settings m
|
||||
historySettings path = defaultSettings {historyFile = path, autoAddHistory = False}
|
||||
|
||||
-- | 排除含口令标记的完整语句
|
||||
rememberStatement :: MonadIO m => T.Text -> InputT m ()
|
||||
rememberStatement statement =
|
||||
unless (T.null (T.strip statement) || any (`T.isInfixOf` T.toCaseFold statement) ["password", "identified"])
|
||||
(modifyHistory (addHistory (T.unpack statement)))
|
||||
@@ -0,0 +1,14 @@
|
||||
module ChuSQL.CLI.Password (readPasswordInput) where
|
||||
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text.IO as T
|
||||
import System.IO (Handle, hIsEOF, hSetNewlineMode, universalNewlineMode)
|
||||
|
||||
-- 管道口令输入:识别 LF 与 CRLF 行尾,保留口令内容。
|
||||
|
||||
-- | 从句柄读取一行口令
|
||||
readPasswordInput :: Handle -> IO Text
|
||||
readPasswordInput handle = do
|
||||
hSetNewlineMode handle universalNewlineMode
|
||||
empty <- hIsEOF handle
|
||||
if empty then pure mempty else T.hGetLine handle
|
||||
@@ -1,5 +0,0 @@
|
||||
module ChuSQL.CLI.Session (module ChuSQL.Interface.Session) where
|
||||
|
||||
import ChuSQL.Interface.Session
|
||||
|
||||
-- 命令行会话:转出前端共享的会话接口,一切请求走 server。
|
||||
Reference in new issue
Block a user