dev-haskell/optparse-applicative: add 0.18.1.0
Signed-off-by: hololeap <hololeap@protonmail.com> Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
parent
760b884627
commit
7f96428df7
|
@ -1,2 +1,3 @@
|
|||
DIST optparse-applicative-0.16.1.0.cabal 4982 BLAKE2B 7e9fed3ff6f09f8b7994d4fd2177ade79e62bc2292dd5fa78bfdf15b0b6f7af0bd696d61ef02ed358460a61f0e2f960d01455091168687f6d2db0b07caf182f6 SHA512 31a1e01b4d0a247c10b1eec2f5bb40e518b447527736b8692846980d182ef2ac4d839b4a24b3d17414fac28700d43d0317deb481c1e0c7ac2b7b38aaafc654a1
|
||||
DIST optparse-applicative-0.16.1.0.tar.gz 58315 BLAKE2B 3998ef8594abd3f0f1e85cc44a3efa19d78751f5d17181e1b203504221c219ebf3fa36ccde7351e5821fe1c4a4c0c16a20fffe92259710dbcc7656f4e3a83c50 SHA512 46bdb37b1328a6dbf271dcdb3483266c0c8412fc489e68e32b114745d9cf0108dd49df6cb565df3470121931a769f11996f5fd9fd8e9e38ed6b6853faab56710
|
||||
DIST optparse-applicative-0.18.1.0.tar.gz 60682 BLAKE2B 7fc64b6d135fbec6165050e059235a34b0cbe0633076acc97f645af9e25d805ddd5bc03101823ac4645bf7c390dd6c19d96505aeb6c54a4253317b6cbc160d8a SHA512 a5a7667cadd3c2785d787cb6bddb009750308376c771f45d72e2245577f42c2946a069bf420d3404653f9f3662cb798341ee96d1ead35dbf95ab42447698e41d
|
||||
|
|
|
@ -5,68 +5,8 @@
|
|||
<email>haskell@gentoo.org</email>
|
||||
<name>Gentoo Haskell</name>
|
||||
</maintainer>
|
||||
<longdescription>
|
||||
Here is a simple example of an applicative option parser:
|
||||
|
||||
@
|
||||
data Sample = Sample
|
||||
&#x20; &#x7b; hello :: String
|
||||
&#x20; , quiet :: Bool &#x7d;
|
||||
|
||||
sample :: Parser Sample
|
||||
sample = Sample
|
||||
&#x20; \<$\> strOption
|
||||
&#x20; ( long \"hello\"
|
||||
&#x20; & metavar \"TARGET\"
|
||||
&#x20; & help \"Target for the greeting\" )
|
||||
&#x20; \<*\> switch
|
||||
&#x20; ( long \"quiet\"
|
||||
&#x20; & help \"Whether to be quiet\" )
|
||||
@
|
||||
|
||||
The parser is built using applicative style starting from a set of basic
|
||||
combinators. In this example, @hello@ is defined as an 'option' with a
|
||||
@String@ argument, while @quiet@ is a boolean 'flag' (called 'switch').
|
||||
|
||||
A parser can be used like this:
|
||||
|
||||
@
|
||||
greet :: Sample -> IO ()
|
||||
greet (Sample h False) = putStrLn $ \"Hello, \" ++ h
|
||||
greet _ = return ()
|
||||
|
||||
main :: IO ()
|
||||
main = execParser opts \>\>= greet
|
||||
&#x20; where
|
||||
&#x20; opts = info (helper \<*\> sample)
|
||||
&#x20; ( fullDesc
|
||||
&#x20; & progDesc \"Print a greeting for TARGET\"
|
||||
&#x20; & header \"hello - a test for optparse-applicative\" )
|
||||
@
|
||||
|
||||
The @greet@ function is the entry point of the program, while @opts@ is a
|
||||
complete description of the program, used when generating a help text. The
|
||||
'helper' combinator takes any parser, and adds a @help@ option to it (which
|
||||
always fails).
|
||||
|
||||
The @hello@ option in this example is mandatory (since it doesn't have a
|
||||
default value), so running the program without any argument will display a
|
||||
help text:
|
||||
|
||||
>hello - a test for optparse-applicative
|
||||
>
|
||||
>Usage: hello --hello TARGET [--quiet]
|
||||
> Print a greeting for TARGET
|
||||
>
|
||||
>Available options:
|
||||
> -h,--help Show this help text
|
||||
> --hello TARGET Target for the greeting
|
||||
> --quiet Whether to be quiet
|
||||
|
||||
containing a short usage summary, and a detailed list of options with
|
||||
descriptions.
|
||||
</longdescription>
|
||||
<upstream>
|
||||
<remote-id type="hackage">optparse-applicative</remote-id>
|
||||
<remote-id type="github">pcapriotti/optparse-applicative</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
# Copyright 1999-2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
# ebuild generated by hackport 0.8.4.0.9999
|
||||
#hackport: flags: +process
|
||||
|
||||
CABAL_FEATURES="lib profile haddock hoogle hscolour test-suite"
|
||||
inherit haskell-cabal
|
||||
|
||||
DESCRIPTION="Utilities and combinators for parsing command line options"
|
||||
HOMEPAGE="https://github.com/pcapriotti/optparse-applicative"
|
||||
|
||||
LICENSE="BSD"
|
||||
SLOT="0/${PV}"
|
||||
KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~x86"
|
||||
|
||||
RDEPEND="
|
||||
>=dev-haskell/prettyprinter-1.7:=[profile?] <dev-haskell/prettyprinter-1.8:=[profile?]
|
||||
>=dev-haskell/prettyprinter-ansi-terminal-1.1:=[profile?] <dev-haskell/prettyprinter-ansi-terminal-1.2:=[profile?]
|
||||
>=dev-haskell/text-1.2:=[profile?]
|
||||
>=dev-haskell/transformers-compat-0.3:=[profile?] <dev-haskell/transformers-compat-0.8:=[profile?]
|
||||
>=dev-lang/ghc-8.10.6:=
|
||||
"
|
||||
DEPEND="${RDEPEND}
|
||||
>=dev-haskell/cabal-3.2.1.0
|
||||
test? (
|
||||
>=dev-haskell/quickcheck-2.8 <dev-haskell/quickcheck-2.15
|
||||
)
|
||||
"
|
||||
|
||||
src_configure() {
|
||||
haskell-cabal_src_configure \
|
||||
--flag=process
|
||||
}
|
Loading…
Reference in New Issue