cli: set device name for remote control via CLI option (#3427)

* cli: set device name for remote control via CLI option

* fix

* add property in tests
This commit is contained in:
Evgeny Poberezkin
2023-11-22 22:11:32 +00:00
committed by GitHub
parent 4af4fbae2b
commit 2d4e99d610
8 changed files with 25 additions and 6 deletions
+11
View File
@@ -19,6 +19,7 @@ where
import Control.Logger.Simple (LogLevel (..))
import qualified Data.Attoparsec.ByteString.Char8 as A
import qualified Data.ByteString.Char8 as B
import Data.Text (Text)
import Numeric.Natural (Natural)
import Options.Applicative
import Simplex.Chat.Controller (ChatLogLevel (..), updateStr, versionNumber, versionString)
@@ -32,6 +33,7 @@ import System.FilePath (combine)
data ChatOpts = ChatOpts
{ coreOptions :: CoreChatOpts,
deviceName :: Maybe Text,
chatCmd :: String,
chatCmdDelay :: Int,
chatServerPort :: Maybe String,
@@ -200,6 +202,14 @@ coreChatOptsP appDir defaultDbFileName = do
chatOptsP :: FilePath -> FilePath -> Parser ChatOpts
chatOptsP appDir defaultDbFileName = do
coreOptions <- coreChatOptsP appDir defaultDbFileName
deviceName <-
optional $
strOption
( long "device-name"
<> short 'e'
<> metavar "DEVICE"
<> help "Device name to use in connections with remote hosts and controller"
)
chatCmd <-
strOption
( long "execute"
@@ -268,6 +278,7 @@ chatOptsP appDir defaultDbFileName = do
pure
ChatOpts
{ coreOptions,
deviceName,
chatCmd,
chatCmdDelay,
chatServerPort,