Portability | portable |
---|---|
Stability | experimental |
Maintainer | Sebastian Reese (str@holumbus.org) |
Version : 0.1
This module provides a tiny and nice implementation of a little command shell with communcation over a socket.
It is basically a copy of Holumbus.Console.Console with some changes to fit network communication.
- type ConsoleData a = Map String (ConsoleCommand a)
- nextOption :: [String] -> IO (Maybe String, [String])
- parseOption :: Read a => [String] -> IO (Maybe a, [String])
- initializeConsole :: ConsoleData a
- addConsoleCommand :: String -> ConsoleFunction a -> String -> ConsoleData a -> ConsoleData a
- startServerConsole :: ConsoleData a -> a -> Int -> String -> IO ()
- defaultaction :: ConsoleData a -> a -> String -> ServerAction String
- defaultconverter :: LineConverter String
Console datatype
type ConsoleData a = Map String (ConsoleCommand a)Source
Map which contains all commands that the user can execute
Operations
nextOption :: [String] -> IO (Maybe String, [String])Source
gets the next option from the command line as string
parseOption :: Read a => [String] -> IO (Maybe a, [String])Source
Simple parser for the commandline...
initializeConsole :: ConsoleData aSource
Creates a new console datatype
:: String | command string (the word the user has to enter when he wants to execute the command) |
-> ConsoleFunction a | the function which should be executed |
-> String | the function description |
-> ConsoleData a | the old console data |
-> ConsoleData a |
Adds a new console command to the function, an existing command with the same name will be overwritten
:: ConsoleData a | the console data |
-> a | the console config |
-> Int | console port |
-> String | a consoles prompt |
-> IO () |
Starts the server listening
defaultaction :: ConsoleData a -> a -> String -> ServerAction StringSource
This defaultimplementaion can be used if a simple INput -> Process command -> output patern is used
defaultconverter :: LineConverter StringSource
default string to a converter. Converts the input lines into desired format. Here String