packages feed

core-program 0.4.6.1 → 0.4.6.4

raw patch · 9 files changed

+39/−35 lines, 9 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ Core.Program.Arguments: instance GHC.Show.Show Core.Program.Arguments.Options

Files

core-program.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           core-program-version:        0.4.6.1+version:        0.4.6.4 synopsis:       Opinionated Haskell Interoperability description:    A library to help build command-line programs, both tools and                 longer-running daemons.
lib/Core/Program/Arguments.hs view
@@ -109,7 +109,7 @@  {- | The setup for parsing the command-line arguments of your program. You build-a @Config@ with 'simple' or 'complex', and pass it to+a @Config@ with 'simpleConfig' or 'complexConfig', and pass it to 'Core.Program.Context.configure'. -} data Config@@ -128,7 +128,7 @@ {- | A completely empty configuration, without the default debugging and logging options. Your program won't process any command-line options or arguments,-which would be weird in most cases. Prefer 'simple'.+which would be weird in most cases. Prefer 'simpleConfig'.  @since 0.2.9 -}@@ -214,7 +214,7 @@  main :: 'IO' () main = do-    context <- 'Core.Program.Execute.configure' ('Core.Program.Execute.fromPackage' version) 'mempty' ('complex'+    context <- 'Core.Program.Execute.configure' ('Core.Program.Execute.fromPackage' version) 'mempty' ('complexConfig'         [ 'Global'             [ 'Option' "station-name" 'Nothing' ('Value' \"NAME\") ['quote'|                 Specify an alternate radio station to connect to when performing@@ -353,17 +353,18 @@     | Argument LongName Description     | Remaining Description     | Variable LongName Description+    deriving (Show)  appendOption :: Options -> Config -> Config appendOption option config =     case config of         Blank -> Blank-        Simple options -> Simple (List.reverse (option : options))+        Simple options -> Simple (options ++ [option])         Complex commands -> Complex (List.foldl' f [] commands)   where     f :: [Commands] -> Commands -> [Commands]     f acc command = case command of-        Global options -> Global (List.reverse (option : options)) : acc+        Global options -> Global (options ++ [option]) : acc         c@(Command _ _ _) -> c : acc  {- |@@ -536,18 +537,19 @@ programName = unsafePerformIO getProgName  {- |-Given a program configuration schema and the command-line arguments,-process them into key/value pairs in a Parameters object.+Given a program configuration schema and the command-line arguments, process+them into key/value pairs in a Parameters object. -This results in 'InvalidCommandLine' on the left side if one of the passed-in options is unrecognized or if there is some other problem handling-options or arguments (because at that point, we want to rabbit right back-to the top and bail out; there's no recovering).+This results in 'InvalidCommandLine' on the left side if one of the passed in+options is unrecognized or if there is some other problem handling options or+arguments (because at that point, we want to rabbit right back to the top and+bail out; there's no recovering).  This isn't something you'll ever need to call directly; it's exposed for testing convenience. This function is invoked when you call 'Core.Program.Context.configure' or 'Core.Program.Execute.execute' (which-calls 'configure' with a default @Config@ when initializing).+calls 'Core.Program.Context.configure' with a default 'Config' when+initializing). -} parseCommandLine :: Config -> [String] -> Either InvalidCommandLine Parameters parseCommandLine config argv = case config of@@ -709,10 +711,10 @@     List.foldl' k emptyMap commands   where     k :: Map LongName [Options] -> Commands -> Map LongName [Options]-    k modes (Command longname _ options)  = insertKeyValue longname options modes-    k modes _  = modes+    k modes (Command longname _ options) = insertKeyValue longname options modes+    k modes _ = modes -{- |+{- Break the command-line apart in two steps. The first peels off the global options, the second below looks to see if there is a command (of fails) and if so, whether it has any parameters.
lib/Core/Program/Execute.hs view
@@ -207,9 +207,9 @@ The one and only time you want this is inside an endless loop:  @-    forever $ do-        trap_-            ( bracket+    'Conrol.Monad.forever' $ do+        'trap_'+            ( 'bracket'                 obtainResource                 releaseResource                 useResource@@ -534,7 +534,7 @@ Retreive the current terminal's width, in characters.  If you are outputting an object with a 'Core.Text.Untilities.Render'-instance then you may not need this; you can instead use 'wrteR' which is+instance then you may not need this; you can instead use 'writeR' which is aware of the width of your terminal and will reflow (in as much as the underlying type's @Render@ instance lets it). -}@@ -580,11 +580,11 @@ 'write' we don't output a trailing newline.  @-    'output' h b+    'outputEntire' h b @  Do /not/ use this to output to @stdout@ as that would bypass the mechanism-used by the 'write'*, 'event', and 'debug'* functions to sequence output+used by the 'write'*, 'info', and 'debug'* functions to sequence output correctly. If you wish to write to the terminal use:  @@@ -666,7 +666,7 @@ reset the timer there.  @-    'forkThread' $ do+    'Core.Program.Threads.forkThread' $ do         'resetTimer'         ... @
lib/Core/Program/Logging.hs view
@@ -98,7 +98,7 @@ written in the order it was executed, and (so long as you don't use the @stdout@ Handle directly yourself) your terminal output will be sound. -Passing @--verbose@ on the command-line of your program will cause 'event' to+Passing @--verbose@ on the command-line of your program will cause 'info' to write its tracing messages to the terminal. This shares the same output channel as the 'write'@*@ functions and will /not/ cause corruption of your program's normal output.@@ -419,12 +419,12 @@  {- | Output a debugging message formed from a label and a value. This is like-'event' above but for the (rather common) case of needing to inspect or record+'info' above but for the (rather common) case of needing to inspect or record the value of a variable when debugging code. This:  @-    'setProgramName' \"hello\"-    name <- 'getProgramName'+    'Core.Program.Execute.setProgramName' \"hello\"+    name <- 'Core.Program.Execute.getProgramName'     'debug' \"programName\" name @ 
lib/Core/Program/Metadata.hs view
@@ -48,7 +48,7 @@  main :: 'IO' () main = do-    context <- 'Core.Program.Execute.configure' \"1.0\" 'Core.Program.Execute.None' ('Core.Program.Arguments.simple' ...+    context <- 'Core.Program.Execute.configure' \"1.0\" 'Core.Program.Execute.None' ('Core.Program.Arguments.simpleConfig' ... @  For more complex usage you can populate a 'Version' object using the@@ -90,8 +90,9 @@  version :: 'Version' version = $('fromPackage') -main :: 'IO' () main = do context <- 'Core.Program.Execute.configure' version-'Core.Program.Execute.None' ('Core.Program.Arguments.simple' ...+main :: 'IO' ()+main = do+    context <- 'Core.Program.Execute.configure' version 'Core.Program.Execute.None' ('Core.Program.Arguments.simpleConfig' ... @  (Using Template Haskell slows down compilation of this file, but the upside of
lib/Core/Program/Signal.hs view
@@ -54,6 +54,7 @@             Output -> pure Debug             Verbose -> pure Debug             Debug -> pure Output+            Internal -> pure Output         )  --
lib/Core/Program/Threads.hs view
@@ -392,7 +392,7 @@  @     'raceThreads_'-        ('sleepThread' 300)+        ('Core.Program.Execute.sleepThread' 300)         (do             -- We expect this to complete within 5 minutes.             performAction
lib/Core/Program/Unlift.hs view
@@ -72,9 +72,9 @@          runProgram $ do             -- now \"unlifted\" back to Program monad!-            'event' \"Starting compile...\"-            'event' \"Nah. Changed our minds\"-            'event' \"Ok, fine, compile the thing\"+            'info' \"Starting compile...\"+            'info' \"Nah. Changed our minds\"+            'info' \"Ok, fine, compile the thing\"          -- more IO         result <- compileSourceCode source
lib/Core/System/Pretty.hs view
@@ -1,6 +1,6 @@ {-# OPTIONS_HADDOCK not-home #-} --- | Re-exports of combinators for use when building 'Render' instances.+-- | Re-exports of combinators for use when building 'Core.Text.Utilities.Render' instances. module Core.System.Pretty (     -- * Pretty Printing