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]
Versions [faq] 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
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 Wed Jan 30 21:12:29 UTC 2019
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 Sun Aug 27 12:57:36 UTC 2017
Distributions NixOS:2.5.0.3, Stackage:2.5.0.3
Executables some-cli
Downloads 1933 total (343 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2017-08-27 [all 1 reports]

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

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.

  • 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.