# 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:
```haskell
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](https://github.com/erickg/structured-cli/blob/master/example/Main.hs) and modify it to suit your needs.