structured-cli 2.0.0.0 → 2.0.0.1
raw patch · 2 files changed
+31/−19 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- README.md +30/−18
- structured-cli.cabal +1/−1
README.md view
@@ -7,11 +7,16 @@ * How to use this module: -The following code illustrates a simple but complete-CLI app:+It is often the case that a simple example is the best user guide, at least for the+experienced programmer. The following code illustrates a basic but functioning CLI application: + ```haskell-import Control.Monad.IO.Class (liftIO)+module Main where++import Control.Monad (void)+import Control.Monad.IO.Class (liftIO)+import Data.Default (def) import System.Console.StructuredCLI root :: Commands ()@@ -19,36 +24,43 @@ world >+ do hello bye- exit $ Just "return to previous level"+ command "exit" "return to previous level" exit world :: Commands ()-world = command "world" (Just "enter into world") Nothing+world = command "world" "enter into the world" $ return NewLevel hello :: Commands ()-hello = command "hello" (Just "prints a greeting") $ Just $ do+hello = command "hello" "prints a greeting" $ do liftIO . putStrLn $ "Hello world!"- return 0+ return NoAction bye :: Commands ()-bye = command "bye" (Just "say goodbye") $ Just $ do+bye = command "bye" "say goodbye" $ do liftIO . putStrLn $ "Sayonara!"- return 0+ return NoAction main :: IO ()-main = runCLI "Hello CLI" Nothing root+main = void $ runCLI "Hello CLI" def root ``` resulting example session: ```-Hello CLI > ?-- world: enter into world-Hello CLI > world-Hello CLI world >-bye exit hello-Hello CLI world > hello+>>> Hello CLI > ?+- world: enter into the world++>>> Hello CLI > world+>>> Hello CLI world > ?+- exit: return to previous level+- bye: say goodbye+- hello: prints a greeting++>>> Hello CLI world > hello Hello world!-Hello CLI world > exit+>>> Hello CLI world > bye+Sayonara!+>>> Hello CLI world > exit+>>> Hello CLI > ``` -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.+A good way to get you started is to grab the example code available under [example/Main.hs](https://gitlab.com/codemonkeylabs/structured-cli/blob/master/example/Main.hs) and modify it to suit your needs.
structured-cli.cabal view
@@ -1,5 +1,5 @@ name: structured-cli-version: 2.0.0.0+version: 2.0.0.1 synopsis: Application library for building interactive console CLIs description: 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. homepage: https://gitlab.com/codemonkeylabs/structured-cli#readme