optparse-applicative 0.16.0.0 → 0.16.1.0
raw patch · 4 files changed
+25/−14 lines, 4 filesdep −bytestringdep ~semigroupsdep ~transformersdep ~transformers-compat
Dependencies removed: bytestring
Dependency ranges changed: semigroups, transformers, transformers-compat
Files
- CHANGELOG.md +8/−0
- optparse-applicative.cabal +9/−3
- src/Options/Applicative/Builder/Completer.hs +8/−0
- tests/test.hs +0/−11
CHANGELOG.md view
@@ -1,3 +1,11 @@+## Version 0.16.1.0 (21 Nov 2020)++- Guard `process` dependency behind an on by default flag.+ This allows one to shrink the dependency tree significantly+ by turning off the ability to use bash completion actions.++- Remove `bytestring` dependency from the test suite.+ ## Version 0.16.0.0 (14 Aug 2020) - Add `Options.Applicative.NonEmpty.some1` function, which
optparse-applicative.cabal view
@@ -1,5 +1,5 @@ name: optparse-applicative-version: 0.16.0.0+version: 0.16.1.0 synopsis: Utilities and combinators for parsing command line options description: optparse-applicative is a haskell library for parsing options@@ -60,6 +60,11 @@ type: git location: https://github.com/pcapriotti/optparse-applicative.git +flag process+ description:+ Depend on the process package for Bash autocompletion+ default: True+ library hs-source-dirs: src ghc-options: -Wall@@ -92,9 +97,11 @@ build-depends: base == 4.* , transformers >= 0.2 && < 0.6 , transformers-compat >= 0.3 && < 0.7- , process >= 1.0 && < 1.7 , ansi-wl-pprint >= 0.6.8 && < 0.7 + if flag(process)+ build-depends: process >= 1.0 && < 1.7+ if !impl(ghc >= 8) build-depends: semigroups >= 0.10 && < 0.20 , fail == 4.9.*@@ -117,7 +124,6 @@ , Examples.Hello build-depends: base- , bytestring >= 0.9 && < 0.11 , optparse-applicative , QuickCheck >= 2.8 && < 2.15
src/Options/Applicative/Builder/Completer.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ module Options.Applicative.Builder.Completer ( Completer , mkCompleter@@ -10,7 +12,9 @@ import Prelude import Control.Exception (IOException, try) import Data.List (isPrefixOf)+#ifdef MIN_VERSION_process import System.Process (readProcess)+#endif import Options.Applicative.Types @@ -31,10 +35,14 @@ -- <http://www.gnu.org/software/bash/manual/html_node/Programmable-Completion-Builtins.html#Programmable-Completion-Builtins> -- for a complete list. bashCompleter :: String -> Completer+#ifdef MIN_VERSION_process bashCompleter action = Completer $ \word -> do let cmd = unwords ["compgen", "-A", action, "--", requote word] result <- tryIO $ readProcess "bash" ["-c", cmd] "" return . lines . either (const []) id $ result+#else+bashCompleter = const $ Completer $ const $ return []+#endif tryIO :: IO a -> IO (Either IOException a) tryIO = try
tests/test.hs view
@@ -12,8 +12,6 @@ import Control.Applicative import Control.Monad-import Data.ByteString (ByteString)-import qualified Data.ByteString.Char8 as BS8 import Data.List hiding (group) import Data.List.NonEmpty (NonEmpty ((:|))) import Data.Semigroup hiding (option)@@ -767,15 +765,6 @@ let (msg, _) = renderFailure failure "prog" in counterexample msg $ isInfixOf "Did you mean one of these?\n first\n fst" msg--prop_bytestring_reader :: Property-prop_bytestring_reader = once $- let t = "testValue"- p :: Parser ByteString- p = argument str idm- i = info p idm- result = run i ["testValue"]- in assertResult result $ \xs -> BS8.pack t === xs prop_grouped_some_option_ellipsis :: Property prop_grouped_some_option_ellipsis = once $