glirc-2.33.1: Console IRC client

Copyright(c) Eric Mertens 2016
LicenseISC
Maintaineremertens@gmail.com
Safe HaskellNone
LanguageHaskell2010

Client.Commands

Contents

Description

This module renders the lines used in the channel mask list. A mask list can show channel bans, quiets, invites, and exceptions.

Synopsis

Documentation

data CommandResult Source #

Possible results of running a command

Constructors

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

execute Source #

Arguments

:: String

chat or command

-> ClientState

client state

-> IO CommandResult

command result

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. Leading spaces before the / are ignored when checking for commands.

executeUserCommand Source #

Arguments

:: Maybe Text

disconnection time

-> String

command

-> ClientState

client state

-> IO CommandResult

command result

Execute command provided by user, resolve aliases if necessary.

The last disconnection time is stored in text form and is available for substitutions in macros. It is only provided when running startup commands during a reconnect event.

commandExpansion Source #

Arguments

:: Maybe Text

disconnect time

-> ClientState

client state

-> Text

expansion variable

-> Maybe Text

expansion value

Compute the replacement value for the given expansion variable.

tabCompletion Source #

Arguments

:: Bool

reversed

-> ClientState

client state

-> IO CommandResult

command result

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

data CommandSection Source #

A command section is a logical grouping of commands. This allows for showing more structure in the help menu system.

data Command Source #

A command is a list of aliases, an argument specification, implementation, and documentation. The arguments and implementation must match so that the parsed arguments will match what the implementation expects.

Constructors

Command 

Fields

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

Constructors

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.

commandsList :: [CommandSection] Source #

Raw list of commands in the order used for /help