Copyright | (c) Eric Mertens, 2016 |
---|---|
License | ISC |
Maintainer | emertens@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
This module renders the lines used in the channel mask list. A mask list can show channel bans, quiets, invites, and exceptions.
- data CommandResult
- execute :: String -> ClientState -> IO CommandResult
- executeUserCommand :: Maybe Text -> String -> ClientState -> IO CommandResult
- commandExpansion :: Maybe Text -> ClientState -> Text -> Maybe Text
- tabCompletion :: Bool -> ClientState -> IO CommandResult
- data Command = Command (ArgumentSpec a) Text (CommandImpl a)
- data CommandImpl a
- = ClientCommand (ClientCommand a) (Bool -> ClientCommand String)
- | NetworkCommand (NetworkCommand a) (Bool -> NetworkCommand String)
- | ChatCommand (ChannelCommand a) (Bool -> ChannelCommand String)
- | ChannelCommand (ChannelCommand a) (Bool -> ChannelCommand String)
- commands :: Recognizer Command
- commandsList :: [(NonEmpty Text, Command)]
Documentation
data CommandResult Source #
Possible results of running a command
CommandSuccess ClientState | Continue running the client, consume input if command was from input |
CommandFailure ClientState | Continue running the client, report an error |
CommandQuit ClientState | Client should close |
:: String | chat or command |
-> ClientState | |
-> IO CommandResult |
Interpret the given chat message or command. Leading /
indicates a
command. Otherwise if a channel or user query is focused a chat message
will be sent.
executeUserCommand :: Maybe Text -> String -> ClientState -> IO CommandResult Source #
Execute command provided by user, resolve aliases if necessary.
:: Maybe Text | disconnect time |
-> ClientState | client state |
-> Text | expansion variable |
-> Maybe Text | expansion value |
Compute the replacement value for the given expansion variable.
:: Bool | reversed |
-> ClientState | |
-> IO CommandResult |
Respond to the TAB key being pressed. This can dispatch to a command specific completion mode when relevant. Otherwise this will complete input based on the users of the channel related to the current buffer.
Commands
A command is an argument specification, implementation, and documentation
Command (ArgumentSpec a) Text (CommandImpl a) |
data CommandImpl a Source #
Pair of implementations for executing a command and tab completing one. The tab-completion logic is extended with a bool indicating that tab completion should be reversed
ClientCommand (ClientCommand a) (Bool -> ClientCommand String) | no requirements |
NetworkCommand (NetworkCommand a) (Bool -> NetworkCommand String) | requires an active network |
ChatCommand (ChannelCommand a) (Bool -> ChannelCommand String) | requires an active chat window |
ChannelCommand (ChannelCommand a) (Bool -> ChannelCommand String) | requires an active channel window |
commands :: Recognizer Command Source #
Map of built-in client commands to their implementations, tab completion logic, and argument structures.