packages feed

cmdlib 0.3.5 → 0.3.6

raw patch · 4 files changed

+13/−5 lines, 4 filesdep ~basePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base

API changes (from Hackage documentation)

- System.Console.CmdLib: (<+<) :: (Typeable a, Typeable b, Monad m) => m a -> m b -> m a
+ System.Console.CmdLib: (<+<) :: (Typeable a, Typeable b) => (String -> a) -> (String -> b) -> (String -> a)
- System.Console.CmdLib: class Attributes a
+ System.Console.CmdLib: class Attributes a where attributes _ = EmptyMap readFlag _ = readCommon
- System.Console.CmdLib: class (Typeable cmd, FlagType flag) => Command cmd flag | cmd -> flag
+ System.Console.CmdLib: class (Typeable cmd, FlagType flag) => Command cmd flag | cmd -> flag where options _ = EmptyMap supercommand _ = False optionStyle _ = Permuted run cmd _ _ = die $ "BUG: Command " ++ cmdname cmd ++ " not implemented." synopsis c = unwords $ cmdname c : opts where opts = usageDescr $ attrFun (cmdattrs c %% flag_attrs) summary _ = "" help _ = "" cmdname c = map toLower $ reverse . takeWhile (/= '.') . reverse . show $ typeOf c cmd = undefined cmd_flag_defaults _ attrs = flag_defaults attrs (flag_empty (undefined :: flag))
- System.Console.CmdLib: class Typeable a => Data a
+ System.Console.CmdLib: class Typeable * a => Data a
- System.Console.CmdLib: class Data cmd => RecordCommand cmd
+ System.Console.CmdLib: class Data cmd => RecordCommand cmd where rec_options _ = EmptyMap rec_optionStyle _ = Permuted rec_superCommand _ = False mode_summary _ = "" mode_help _ = "" mode_synopsis _ = Nothing
- System.Console.CmdLib: class Typeable a
+ System.Console.CmdLib: class Typeable (a :: k)
- System.Console.CmdLib: dispatchR :: (Eq cmd, Eq (Record cmd), Attributes cmd, RecordCommand cmd, Command (RecordMode cmd) f, (Folded f) ~ cmd) => [DispatchOpt] -> [String] -> IO cmd
+ System.Console.CmdLib: dispatchR :: (Eq cmd, Eq (Record cmd), Attributes cmd, RecordCommand cmd, Command (RecordMode cmd) f, Folded f ~ cmd) => [DispatchOpt] -> [String] -> IO cmd

Files

System/Console/CmdLib/Command.hs view
@@ -14,7 +14,7 @@ import Control.Monad( when, forM_ ) import Control.Exception ( evaluate, catch, SomeException ) import System.IO( hPutStrLn, stderr )-import System.Exit+import System.Exit( exitWith, ExitCode(..) ) import Prelude hiding ( catch )  -- | How to process options for a command. See "optionStyle" for details.
System/Console/CmdLib/Flag.hs view
@@ -27,8 +27,14 @@                 deriving Eq  class Attributes a where+  -- | Implement (override) this function to provide attributes to values of the type @a@.   attributes :: a -> AttributeMap Key   attributes _ = EmptyMap+  -- | Override @readFlags@ to add parsers for your custom types that you wish to use as+  -- flag arguments. See also "readCommon". The usual way to achieve this would be:+  -- >   readFlag _ = readCommon <+< platform+  -- >       where platform "ARM" = ARM+  -- >             platform "Win32" = Win32   readFlag :: Data b => a -> String -> b   readFlag _ = readCommon @@ -222,7 +228,8 @@           strlist = (:[])           list w str = map w (splitOn "," str) -(<+<) :: (Typeable a, Typeable b, Monad m) => m a -> m b -> m a+-- | Chain generic parsers. See also "readFlag" and "readCommon".+(<+<) :: (Typeable a, Typeable b) => (String -> a) -> (String -> b) -> (String -> a) (<+<) = extR infixl 8 <+< 
System/Console/CmdLib/Record.hs view
@@ -5,18 +5,19 @@ import System.Console.CmdLib.Command import System.Console.GetOpt import Data.Data+import Data.Generics.Aliases( extR ) import Data.IORef import Data.List( nub, elemIndex ) import Control.Exception ( throw, evaluate ) import Control.Monad ( when ) import Control.Monad.State( evalState, get, put, State, execState ) import Data.Maybe( fromMaybe, fromJust )-import System.Exit+import System.Exit( exitWith, ExitCode(..) )  import System.Console.CmdLib.Flag  append :: forall a. (Data a) => a -> a -> a-append a = any <+< list+append a = any `extR` list   where any = const a         list :: (Typeable b) => b -> [String]         list = (++(fromJust $ cast a)) . fromJust . cast
cmdlib.cabal view
@@ -1,5 +1,5 @@ name:        cmdlib-version:     0.3.5+version:     0.3.6 synopsis:    a library for command line parsing & online help  description: A commandline parsing library, based on getopt. Comes with a