Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds defaultMainWithHooksNoReadArgs #4859

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 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,12 @@ defaultMainWithHooksNoRead hooks pkg_descr =
getArgs >>=
defaultMainHelper hooks { readDesc = return (Just pkg_descr) }

-- | A customizable version of 'defaultMainNoRead' that also takes the
-- command line arguments.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a @since annotation. Otherwise OK.

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