Hello community,
here is the log from the commit of package ghc-optparse-applicative for
openSUSE:Factory checked in at 2016-01-28 17:24:03
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-optparse-applicative (Old)
and /work/SRC/openSUSE:Factory/.ghc-optparse-applicative.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-optparse-applicative"
Changes:
--------
---
/work/SRC/openSUSE:Factory/ghc-optparse-applicative/ghc-optparse-applicative.changes
2016-01-08 15:22:53.000000000 +0100
+++
/work/SRC/openSUSE:Factory/.ghc-optparse-applicative.new/ghc-optparse-applicative.changes
2016-01-28 17:24:58.000000000 +0100
@@ -1,0 +2,7 @@
+Wed Jan 20 09:59:00 UTC 2016 - [email protected]
+
+- update to 0.12.1.0
+* Improve subparser contexts to improve usage error texts
+* Fixed bugs
+
+-------------------------------------------------------------------
Old:
----
optparse-applicative-0.12.0.0.tar.gz
New:
----
optparse-applicative-0.12.1.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-optparse-applicative.spec ++++++
--- /var/tmp/diff_new_pack.shnxZg/_old 2016-01-28 17:24:59.000000000 +0100
+++ /var/tmp/diff_new_pack.shnxZg/_new 2016-01-28 17:24:59.000000000 +0100
@@ -18,7 +18,7 @@
%global pkg_name optparse-applicative
Name: ghc-optparse-applicative
-Version: 0.12.0.0
+Version: 0.12.1.0
Release: 0
Summary: Utilities and combinators for parsing command line options
Group: System/Libraries
++++++ optparse-applicative-0.12.0.0.tar.gz ->
optparse-applicative-0.12.1.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/optparse-applicative-0.12.0.0/CHANGELOG.md
new/optparse-applicative-0.12.1.0/CHANGELOG.md
--- old/optparse-applicative-0.12.0.0/CHANGELOG.md 2015-09-25
12:00:41.000000000 +0200
+++ new/optparse-applicative-0.12.1.0/CHANGELOG.md 2016-01-19
10:57:20.000000000 +0100
@@ -1,3 +1,17 @@
+## Version 0.12.1.0 (18 Jan 2016)
+
+- Updated dependency bounds.
+
+- Improve subparser contexts to improve usage error texts
+
+- Doc
+
+- Fixed bugs
+ * \# 164 - Invalid options and invalid arguments after parser has succeeded
+ not displaying
+ * \# 146 - multi-word filename completion is broken
+
+
## Version 0.12.0.0 (17 Sep 2015)
- Add "missing" error condition descriptions when required flags and arguments
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/optparse-applicative-0.12.0.0/Options/Applicative/BashCompletion.hs
new/optparse-applicative-0.12.1.0/Options/Applicative/BashCompletion.hs
--- old/optparse-applicative-0.12.0.0/Options/Applicative/BashCompletion.hs
2015-09-25 12:00:41.000000000 +0200
+++ new/optparse-applicative-0.12.1.0/Options/Applicative/BashCompletion.hs
2016-01-19 10:57:20.000000000 +0100
@@ -78,6 +78,7 @@
[ "_" ++ progn ++ "()"
, "{"
, " local cmdline"
+ , " local IFS=$'\n'"
, " CMDLINE=(--bash-completion-index $COMP_CWORD)"
, ""
, " for arg in ${COMP_WORDS[@]}; do"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/optparse-applicative-0.12.0.0/Options/Applicative/Common.hs
new/optparse-applicative-0.12.1.0/Options/Applicative/Common.hs
--- old/optparse-applicative-0.12.0.0/Options/Applicative/Common.hs
2015-09-25 12:00:41.000000000 +0200
+++ new/optparse-applicative-0.12.1.0/Options/Applicative/Common.hs
2016-01-19 10:57:20.000000000 +0100
@@ -52,7 +52,7 @@
OptDescStyle (..)
) where
-import Control.Applicative (pure, (<*>), (<$>), (<|>), (<$))
+import Control.Applicative (pure, (<*>), (<*), (*>), (<$>), (<|>), (<$))
import Control.Arrow (left)
import Control.Monad (guard, mzero, msum, when, liftM)
import Control.Monad.Trans.Class (lift)
@@ -102,14 +102,13 @@
return result
CmdReader _ f ->
flip fmap (f arg) $ \subp -> StateT $ \args -> do
- setContext (Just arg) subp
prefs <- getPrefs
let runSubparser
| prefBacktrack prefs = \i a ->
runParser (getPolicy i) (infoParser i) a
| otherwise = \i a
-> (,) <$> runParserInfo i a <*> pure []
- runSubparser subp args
+ enterContext arg subp *> runSubparser subp args <* exitContext
_ -> Nothing
optMatches :: MonadP m => Bool -> OptReader a -> OptWord -> Maybe (StateT Args
m a)
@@ -243,8 +242,9 @@
runParserFully :: MonadP m => ArgPolicy -> Parser a -> Args -> m a
runParserFully policy p args = do
(r, args') <- runParser policy p args
- guard $ null args'
- return r
+ case args' of
+ [] -> return r
+ a:_ -> parseError a
-- | The default value of a 'Parser'. This function returns an error if any of
-- the options don't have a default value.
@@ -258,13 +258,11 @@
= Left $ Leaf (f (OptHelpInfo m d) opt)
| otherwise
= Left $ MultNode []
-evalParser m d f (MultP p1 p2) = case evalParser m d f p1 <*> evalParser m d f
p2 of
- Right a -> Right a
- Left _ -> case (evalParser m d f p1, evalParser m d f p2) of
- (Left a', Left b') -> Left $ MultNode [a', b']
- (Left a', _) -> Left $ MultNode [a']
- (_, Left b') -> Left $ MultNode [b']
- _ -> Left $ MultNode []
+evalParser m d f (MultP p1 p2) = case (evalParser m d f p1, evalParser m d f
p2) of
+ (Right a', Right b') -> Right $ a' b'
+ (Left a', Left b') -> Left $ MultNode [a', b']
+ (Left a', _) -> Left $ MultNode [a']
+ (_, Left b') -> Left $ MultNode [b']
evalParser m d f (AltP p1 p2) = case (evalParser m d f p1, evalParser m d f
p2) of
(Right a', _) -> Right a'
(_, Right b') -> Right b'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/optparse-applicative-0.12.0.0/Options/Applicative/Extra.hs
new/optparse-applicative-0.12.1.0/Options/Applicative/Extra.hs
--- old/optparse-applicative-0.12.0.0/Options/Applicative/Extra.hs
2015-09-25 12:00:41.000000000 +0200
+++ new/optparse-applicative-0.12.1.0/Options/Applicative/Extra.hs
2016-01-19 10:57:20.000000000 +0100
@@ -44,6 +44,9 @@
, help "Show this help text"
, hidden ]
+-- | Builder for a command parser with a \"helper\" option attached.
+-- Used in the same way as `subparser`, but includes a \"--help|-h\" inside
+-- the subcommand.
hsubparser :: Mod CommandFields a -> Parser a
hsubparser m = mkParser d g rdr
where
@@ -133,7 +136,7 @@
--
-- @handleParseResult . Failure $ parserFailure pprefs pinfo ShowHelpText
mempty@
parserFailure :: ParserPrefs -> ParserInfo a
- -> ParseError -> Context
+ -> ParseError -> [Context]
-> ParserFailure ParserHelp
parserFailure pprefs pinfo msg ctx = ParserFailure $ \progn ->
let h = with_context ctx pinfo $ \names pinfo' -> mconcat
@@ -149,12 +152,12 @@
ShowHelpText -> ExitSuccess
InfoMsg _ -> ExitSuccess
- with_context :: Context
+ with_context :: [Context]
-> ParserInfo a
-> (forall b . [String] -> ParserInfo b -> c)
-> c
- with_context NullContext i f = f [] i
- with_context (Context n i) _ f = f n i
+ with_context [] i f = f [] i
+ with_context c@(Context _ i:_) _ f = f (contextNames c) i
usage_help progn names i = case msg of
InfoMsg _ -> mempty
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/optparse-applicative-0.12.0.0/Options/Applicative/Internal.hs
new/optparse-applicative-0.12.1.0/Options/Applicative/Internal.hs
--- old/optparse-applicative-0.12.0.0/Options/Applicative/Internal.hs
2015-09-25 12:00:41.000000000 +0200
+++ new/optparse-applicative-0.12.1.0/Options/Applicative/Internal.hs
2016-01-19 10:57:20.000000000 +0100
@@ -17,6 +17,7 @@
, runCompletion
, SomeParser(..)
, ComplError(..)
+ , contextNames
, ListT
, takeListT
@@ -35,15 +36,13 @@
(runExcept, runExceptT, withExcept, ExceptT(..), throwE, catchE)
import Control.Monad.Trans.Reader
(mapReaderT, runReader, runReaderT, Reader, ReaderT, ask)
-import Control.Monad.Trans.Writer (runWriterT, WriterT, tell)
-import Control.Monad.Trans.State (StateT, get, put, evalStateT)
-import Data.Maybe (maybeToList)
-import Data.Monoid (Monoid(..))
+import Control.Monad.Trans.State (StateT, get, put, modify, evalStateT,
runStateT)
import Options.Applicative.Types
class (Alternative m, MonadPlus m) => MonadP m where
- setContext :: Maybe String -> ParserInfo a -> m ()
+ enterContext :: String -> ParserInfo a -> m ()
+ exitContext :: m ()
getPrefs :: m ParserPrefs
missingArgP :: ParseError -> Completer -> m a
@@ -51,7 +50,7 @@
errorP :: ParseError -> m a
exitP :: Parser b -> Either ParseError a -> m a
-newtype P a = P (ExceptT ParseError (WriterT Context (Reader ParserPrefs)) a)
+newtype P a = P (ExceptT ParseError (StateT [Context] (Reader ParserPrefs)) a)
instance Functor P where
fmap f (P m) = P $ fmap f m
@@ -74,20 +73,16 @@
data Context
- = forall a . Context [String] (ParserInfo a)
- | NullContext
+ = forall a . Context String (ParserInfo a)
-contextNames :: Context -> [String]
-contextNames (Context ns _) = ns
-contextNames NullContext = []
-
-instance Monoid Context where
- mempty = NullContext
- mappend c (Context ns i) = Context (contextNames c ++ ns) i
- mappend c _ = c
+contextNames :: [Context] -> [String]
+contextNames ns =
+ let go (Context n _) = n
+ in reverse $ go <$> ns
instance MonadP P where
- setContext name = P . lift . tell . Context (maybeToList name)
+ enterContext name pinfo = P $ lift $ modify $ (:) $ Context name pinfo
+ exitContext = P $ lift $ modify $ drop 1
getPrefs = P . lift . lift $ ask
missingArgP e _ = errorP e
@@ -101,8 +96,8 @@
hoistEither :: MonadP m => Either ParseError a -> m a
hoistEither = either errorP return
-runP :: P a -> ParserPrefs -> (Either ParseError a, Context)
-runP (P p) = runReader . runWriterT . runExceptT $ p
+runP :: P a -> ParserPrefs -> (Either ParseError a, [Context])
+runP (P p) = runReader . flip runStateT [] . runExceptT $ p
uncons :: [a] -> Maybe (a, [a])
uncons [] = Nothing
@@ -165,7 +160,8 @@
mplus (Completion x) (Completion y) = Completion $ mplus x y
instance MonadP Completion where
- setContext _ _ = return ()
+ enterContext _ _ = return ()
+ exitContext = return ()
getPrefs = Completion $ lift ask
missingArgP _ = Completion . lift . lift . ComplOption
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/optparse-applicative-0.12.0.0/optparse-applicative.cabal
new/optparse-applicative-0.12.1.0/optparse-applicative.cabal
--- old/optparse-applicative-0.12.0.0/optparse-applicative.cabal
2015-09-25 12:00:41.000000000 +0200
+++ new/optparse-applicative-0.12.1.0/optparse-applicative.cabal
2016-01-19 10:57:20.000000000 +0100
@@ -1,5 +1,5 @@
name: optparse-applicative
-version: 0.12.0.0
+version: 0.12.1.0
synopsis: Utilities and combinators for parsing command line options
description:
Here is a simple example of an applicative option parser:
@@ -110,7 +110,7 @@
Options.Applicative.Internal
ghc-options: -Wall
build-depends: base == 4.*,
- transformers >= 0.2 && < 0.5,
- transformers-compat >= 0.3 && < 0.5,
- process >= 1.0 && < 1.4,
+ transformers >= 0.2 && < 0.6,
+ transformers-compat >= 0.3 && < 0.6,
+ process >= 1.0 && < 1.5,
ansi-wl-pprint >= 0.6.6 && < 0.7