-
Notifications
You must be signed in to change notification settings - Fork 701
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6734 from phadej/add-project-flags
Add ProjectFlags, use in sdist
- Loading branch information
Showing
7 changed files
with
94 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{-# LANGUAGE MultiWayIf #-} | ||
{-# LANGUAGE OverloadedStrings #-} | ||
module Distribution.Client.ProjectFlags ( | ||
ProjectFlags(..), | ||
defaultProjectFlags, | ||
projectFlagsOptions, | ||
) where | ||
|
||
import Distribution.Client.Compat.Prelude | ||
import Prelude () | ||
|
||
import Distribution.ReadE (succeedReadE) | ||
import Distribution.Simple.Command (OptionField, option, reqArg) | ||
import Distribution.Simple.Setup (Flag (..), toFlag, trueArg, flagToList) | ||
|
||
data ProjectFlags = ProjectFlags | ||
{ flagProjectFileName :: Flag FilePath | ||
, flagIgnoreProject :: Flag Bool | ||
} | ||
|
||
defaultProjectFlags :: ProjectFlags | ||
defaultProjectFlags = ProjectFlags | ||
{ flagProjectFileName = mempty | ||
, flagIgnoreProject = toFlag False | ||
} | ||
|
||
projectFlagsOptions :: [OptionField ProjectFlags] | ||
projectFlagsOptions = | ||
[ option [] ["project-file"] | ||
"Set the name of the cabal.project file to search for in parent directories" | ||
flagProjectFileName (\pf flags -> flags { flagProjectFileName = pf }) | ||
(reqArg "FILE" (succeedReadE Flag) flagToList) | ||
, option ['z'] ["ignore-project"] | ||
"Ignore local project configuration" | ||
flagIgnoreProject (\v flags -> flags { flagIgnoreProject = v }) | ||
trueArg | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters