File: options.cabal

package info (click to toggle)
haskell-options 1.2.1.1-9
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 184 kB
  • sloc: haskell: 2,143; ansic: 91; makefile: 2
file content (140 lines) | stat: -rw-r--r-- 3,265 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: options
version: 1.2.1.1
license: MIT
license-file: license.txt
author: John Millikin <john@john-millikin.com>
maintainer: John Millikin <john@john-millikin.com>
build-type: Simple
cabal-version: >= 1.8
category: Console
stability: stable
homepage: https://john-millikin.com/software/haskell-options/

synopsis: A powerful and easy-to-use command-line option parser.
description:
  The @options@ package lets library and application developers easily work
  with command-line options.
  .
  The following example is a full program that can accept two options,
  @--message@ and @--quiet@:
  .
  @
  import Control.Applicative
  import Options
  .
  data MainOptions = MainOptions
  &#x20;   &#x7b; optMessage :: String
  &#x20;   , optQuiet :: Bool
  &#x20;   &#x7d;
  .
  instance 'Options' MainOptions where
  &#x20;   defineOptions = pure MainOptions
  &#x20;       \<*\> simpleOption \"message\" \"Hello world!\"
  &#x20;           \"A message to show the user.\"
  &#x20;       \<*\> simpleOption \"quiet\" False
  &#x20;           \"Whether to be quiet.\"
  .
  main :: IO ()
  main = runCommand $ \\opts args -> do
  &#x20;   if optQuiet opts
  &#x20;       then return ()
  &#x20;       else putStrLn (optMessage opts)
  @
  .
  >$ ./hello
  >Hello world!
  >$ ./hello --message='ciao mondo'
  >ciao mondo
  >$ ./hello --quiet
  >$
  .
  In addition, this library will automatically create documentation options
  such as @--help@ and @--help-all@:
  .
  >$ ./hello --help
  >Help Options:
  >  -h, --help
  >    Show option summary.
  >  --help-all
  >    Show all help options.
  >
  >Application Options:
  >  --message :: text
  >    A message to show the user.
  >    default: "Hello world!"
  >  --quiet :: bool
  >    Whether to be quiet.
  >    default: false


extra-source-files:
  cbits/hoehrmann_utf8.c
  cbits/utf8.c

source-repository head
  type: git
  location: https://john-millikin.com/code/haskell-options/

source-repository this
  type: git
  location: https://john-millikin.com/code/haskell-options/
  tag: haskell-options_1.2.1.1

library
  ghc-options: -Wall -O2
  cc-options: -Wall
  hs-source-dirs: lib

  if !os(windows) && impl(ghc < 7.2)
      cpp-options: -DOPTIONS_ENCODING_UTF8
      c-sources: cbits/utf8.c
      build-depends:
          bytestring >= 0.9

  if impl(ghc > 7.4)
    ghc-options: -fwarn-unsafe

  build-depends:
      base >= 4.1 && < 5.0
    , containers >= 0.1
    , monads-tf >= 0.1
    , transformers >= 0.2

  exposed-modules:
    Options

  other-modules:
    Options.Help
    Options.Tokenize
    Options.Types
    Options.Util

test-suite options_tests
  type: exitcode-stdio-1.0
  main-is: OptionsTests.hs

  ghc-options: -Wall -O2
  cc-options: -Wall
  hs-source-dirs: lib,tests

  if !os(windows) && impl(ghc < 7.2)
      cpp-options: -DOPTIONS_ENCODING_UTF8
      c-sources: cbits/utf8.c
      build-depends:
          bytestring >= 0.9

  build-depends:
      base >= 4.0 && < 5.0
    , chell >= 0.4 && < 0.5
    , chell-quickcheck >= 0.2 && < 0.3
    , containers >= 0.1
    , monads-tf >= 0.1
    , transformers >= 0.2

  other-modules:
    OptionsTests.Api
    OptionsTests.Help
    OptionsTests.OptionTypes
    OptionsTests.StringParsing
    OptionsTests.Tokenize
    OptionsTests.Util