structured-cli: Application library for building interactive console CLIs

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

This module provides the tools to build a complete "structured" CLI application, similar to those found in systems like Cisco IOS or console configuration utilities etc. It aims to be easy for implementors to use.


[Skip to Readme]

Properties

Versions 0.9.0.2, 0.9.0.3, 0.9.0.3, 0.9.1.0, 0.9.2.0, 0.9.3.0, 0.9.3.1, 0.9.4.0, 0.9.4.1, 2.0.0.0, 2.0.0.1, 2.2.0.0, 2.2.1.0, 2.3.0.0, 2.4.0.0, 2.4.0.1, 2.5.0.0, 2.5.0.1, 2.5.0.2, 2.5.0.3, 2.5.1.0, 2.5.2.0, 2.6.0.0, 2.7.0.0, 2.7.0.1
Change log None available
Dependencies base (>=4.7 && <5), data-default, haskeline, mtl, split, structured-cli, transformers [details]
License BSD-3-Clause
Copyright 2017 Erick Gonzalez
Author Erick Gonzalez
Maintainer erick@codemonkeylabs.de
Category Console
Home page https://github.com/erickg/structured-cli#readme
Source repo head: git clone https://github.com/erickg/structured-cli
Uploaded by erick at 2017-08-27T12:57:06Z

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for structured-cli-0.9.0.3

[back to package description]

structured-cli

Haskell library for building structured CLI applications

This module provides the tools to build a complete "structured" CLI application, similar to those found in systems like Cisco IOS or console configuration utilities etc. It aims to be easy for implementors to use.

The following code illustrates a simple but complete CLI app:

import Control.Monad.IO.Class (liftIO)
import System.Console.StructuredCLI

root :: Commands ()
root = do
  world >+ do
    hello
    bye
    exit $ Just "return to previous level"

world :: Commands ()
world = command "world" (Just "enter into world") Nothing

hello :: Commands ()
hello = command "hello" (Just "prints a greeting") $ Just $ do
          liftIO . putStrLn $ "Hello world!"
          return 0

bye :: Commands ()
bye = command "bye" (Just "say goodbye") $ Just $ do
        liftIO . putStrLn $ "Sayonara!"
        return 0

main :: IO ()
main = runCLI "Hello CLI" Nothing root

resulting example session:

Hello CLI > ?
- world: enter into world
Hello CLI > world
Hello CLI world >
bye    exit   hello
Hello CLI world > hello
Hello world!
Hello CLI world > exit

A good way to get you started is to grab the example code available under example/Main.hs and modify it to suit your needs.