cli: Command Line Interface

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

All you need for interacting with users at the Console level

  • Display routines, formatting, progress bars

  • Options parsing


[Skip to Readme]

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

  • No Candidates
Versions [RSS] 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.1.0, 0.1.1, 0.1.2, 0.2.0
Dependencies base (>=4.5 && <4.11), mtl, terminfo, transformers [details]
License BSD-3-Clause
Copyright Vincent Hanquez <vincent@snarc.org>, Nicolas Di Prima <nicolas@di-prima.fr>
Author Vincent Hanquez <vincent@snarc.org>, Nicolas Di Prima <nicolas@di-prima.fr>
Maintainer vincent@snarc.org
Revised Revision 1 made by HerbertValerioRiedel at 2019-01-03T22:09:22Z
Category cli
Home page https://github.com/vincenthz/hs-cli
Bug tracker https://github.com/vincenthz/hs-cli/issues
Source repo head: git clone https://github.com/vincenthz/hs-cli
Uploaded by VincentHanquez at 2016-02-16T08:25:44Z
Distributions NixOS:0.2.0
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 7045 total (29 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2016-02-16 [all 1 reports]

Readme for cli-0.1.2

[back to package description]

cli

Build Status BSD Haskell

Documentation: cli on hackage

Option parser in DSL form, and display utilities for command line interfaces.

Option Parsing

Basic program looks like:

defaultMain $ do
    f1 <- flag ..
    f2 <- argument ..
    action $ \toParam ->
        something (toParam f1) (toParam f2) ..

with subcommands:

defaultMain $ do
    subcommand "foo" $ do
       <..flags & parameters definitions...>
       action $ \toParam -> <..IO-action..>
    subcommand "bar" $ do
       <..flags & parameters definitions...>
       action $ \toParam -> <..IO-action..>

A Real Example:

main = defaultMain $ do
    programName "test-cli"
    programDescription "test CLI program"
    flagA    <- flag $ FlagShort 'a' <> FlagLong "aaa"
    allArgs  <- remainingArguments "FILE"
    action $ \toParam -> do
        putStrLn $ "using flag A : " ++ show (toParam flagA)
        putStrLn $ "args: " ++ show (toParam allArgs)