structured-cli: Application library for building interactive console CLIs

[ bsd3, console, library, program ] [ Propose Tags ]

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]

Modules

[Index]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.9.0.2, 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
Dependencies base (>=4.9.1.0 && <4.12), data-default (>=0.7.1.1 && <0.8), haskeline (>=0.7.4.0 && <0.8), mtl (>=2.2.1 && <3.0), split (>=0.2.3.2 && <0.3), structured-cli, transformers (>=0.5.2.0 && <0.6) [details]
License BSD-3-Clause
Copyright 2017 Erick Gonzalez
Author Erick Gonzalez
Maintainer erick@codemonkeylabs.de
Revised Revision 3 made by erick at 2019-01-30T21:12:29Z
Category Console
Home page https://gitlab.com/codemonkeylabs/structured-cli#readme
Bug tracker https://gitlab.com/codemonkeylabs/structured-cli/issues
Source repo head: git clone https://gitlab.com/codemonkeylabs/structured-cli
Uploaded by erick at 2017-08-27T12:57:36Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Executables some-cli
Downloads 11118 total (62 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-08-27 [all 1 reports]

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.

  • How to use this module:

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.