glirc-2.20.3: Console IRC client

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

Client.Commands.Arguments

Description

This module provides a description for the arguments expected by command commands as well as a way to parse those arguments.

Synopsis

Documentation

data ArgumentSpec :: * -> * where Source #

Description of a command's arguments indexed by the result of parsing those arguments. Arguments are annotated with a String describing the argument.

Constructors

ReqTokenArg :: String -> ArgumentSpec rest -> ArgumentSpec (String, rest)

A required space-delimited token

OptTokenArg :: String -> ArgumentSpec rest -> ArgumentSpec (Maybe (String, rest))

An optional space-delimited token

RemainingArg :: String -> ArgumentSpec String

Take all the remaining text in free-form

NoArg :: ArgumentSpec ()

No arguments

parseArguments Source #

Arguments

:: ArgumentSpec a

specification

-> String

input string

-> Maybe a

parse results

Parse the given input string using an argument specification. The arguments should start with a space but might have more.