rename option

This commit is contained in:
Evgeny Poberezkin
2024-11-30 20:40:30 +00:00
parent 486c19c1d6
commit e9a443e049
7 changed files with 14 additions and 14 deletions
@@ -76,7 +76,7 @@ mkChatOpts BroadcastBotOpts {coreOptions} =
ChatOpts
{ coreOptions,
deviceName = Nothing,
displayName = Nothing,
userDisplayName = Nothing,
chatCmd = "",
chatCmdDelay = 3,
chatCmdLog = CCLNone,
@@ -85,7 +85,7 @@ mkChatOpts DirectoryOpts {coreOptions} =
ChatOpts
{ coreOptions,
deviceName = Nothing,
displayName = Nothing,
userDisplayName = Nothing,
chatCmd = "",
chatCmdDelay = 3,
chatCmdLog = CCLNone,
+3 -3
View File
@@ -65,9 +65,9 @@ sendChatCmd :: ChatController -> ChatCommand -> IO ChatResponse
sendChatCmd cc cmd = runReaderT (execChatCommand' cmd) cc
getSelectActiveUser :: SQLiteStore -> ChatOpts -> IO (Maybe User)
getSelectActiveUser st ChatOpts {displayName} = do
getSelectActiveUser st ChatOpts {userDisplayName} = do
users <- withTransaction st getUsers
case displayName of
case userDisplayName of
Just name ->
forM (find (\User {localDisplayName} -> localDisplayName == name) users) $ \u ->
if activeUser u then pure u else withTransaction st (`setActiveUser` u)
@@ -95,7 +95,7 @@ getSelectActiveUser st ChatOpts {displayName} = do
in Just <$> withTransaction st (`setActiveUser` user)
createActiveUser :: ChatController -> ChatOpts -> IO User
createActiveUser cc ChatOpts {displayName = name} = do
createActiveUser cc ChatOpts {userDisplayName = name} = do
putStrLn
"No user profiles found, it will be created now.\n\
\Please choose your display name.\n\
+1 -1
View File
@@ -202,7 +202,7 @@ mobileChatOpts dbFilePrefix =
yesToUpMigrations = False
},
deviceName = Nothing,
displayName = Nothing,
userDisplayName = Nothing,
chatCmd = "",
chatCmdDelay = 3,
chatCmdLog = CCLNone,
+4 -4
View File
@@ -40,7 +40,7 @@ import Simplex.Chat.Types (ContactName)
data ChatOpts = ChatOpts
{ coreOptions :: CoreChatOpts,
deviceName :: Maybe Text,
displayName :: Maybe ContactName,
userDisplayName :: Maybe ContactName,
chatCmd :: String,
chatCmdDelay :: Int,
chatCmdLog :: ChatCmdLog,
@@ -288,10 +288,10 @@ chatOptsP appDir defaultDbFileName = do
<> metavar "DEVICE"
<> help "Device name to use in connections with remote hosts and controller"
)
displayName <-
userDisplayName <-
optional $
strOption
( long "display-name"
( long "user-display-name"
<> metavar "DISPLAY_NAME"
<> help "Create new or switch to existing user profile with this display name."
)
@@ -384,7 +384,7 @@ chatOptsP appDir defaultDbFileName = do
pure
ChatOpts
{ coreOptions,
displayName,
userDisplayName,
deviceName,
chatCmd,
chatCmdDelay,
+1 -1
View File
@@ -74,7 +74,7 @@ testOpts =
ChatOpts
{ coreOptions = testCoreOpts,
deviceName = Nothing,
displayName = Nothing,
userDisplayName = Nothing,
chatCmd = "",
chatCmdDelay = 3,
chatCmdLog = CCLNone,
+3 -3
View File
@@ -224,9 +224,9 @@ testMultiWordProfileNames =
alice #> "@'Cath J' hi"
cath <# "'Alice Jones'> hi"
where
aliceProfile' = (baseProfile :: Profile) {displayName = "Alice Jones"}
bobProfile' = (baseProfile :: Profile) {displayName = "Bob James"}
cathProfile' = (baseProfile :: Profile) {displayName = "Cath Johnson"}
aliceProfile' = baseProfile {displayName = "Alice Jones"}
bobProfile' = baseProfile {displayName = "Bob James"}
cathProfile' = baseProfile {displayName = "Cath Johnson"}
baseProfile = Profile {displayName = "", fullName = "", image = Nothing, contactLink = Nothing, preferences = defaultPrefs}
testUserContactLink :: HasCallStack => FilePath -> IO ()