Skip to content

Commit

Permalink
Merge pull request #4859 from zw3rk/feature/defaultMainWithHooksNoRea…
Browse files Browse the repository at this point in the history
…dArgs

Adds defaultMainWithHooksNoReadArgs
  • Loading branch information
23Skidoo authored Nov 3, 2017
2 parents af81cfb + 4031811 commit 5cc8755
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Cabal/Distribution/Simple.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module Distribution.Simple (
-- * Customization
UserHooks(..), Args,
defaultMainWithHooks, defaultMainWithHooksArgs,
defaultMainWithHooksNoRead,
defaultMainWithHooksNoRead, defaultMainWithHooksNoReadArgs,
-- ** Standard sets of hooks
simpleUserHooks,
autoconfUserHooks,
Expand Down Expand Up @@ -138,6 +138,14 @@ defaultMainWithHooksNoRead hooks pkg_descr =
getArgs >>=
defaultMainHelper hooks { readDesc = return (Just pkg_descr) }

-- | A customizable version of 'defaultMainNoRead' that also takes the
-- command line arguments.
--
-- @since 2.2.0.0
defaultMainWithHooksNoReadArgs :: UserHooks -> GenericPackageDescription -> [String] -> IO ()
defaultMainWithHooksNoReadArgs hooks pkg_descr =
defaultMainHelper hooks { readDesc = return (Just pkg_descr) }

defaultMainHelper :: UserHooks -> Args -> IO ()
defaultMainHelper hooks args = topHandler $
case commandsRun (globalCommand commands) commands args of
Expand Down

0 comments on commit 5cc8755

Please sign in to comment.