Skip to content

Commit

Permalink
Parse --prepublish flags properly
Browse files Browse the repository at this point in the history
  • Loading branch information
process-bot committed Apr 21, 2016
1 parent d2ce5ce commit 3d4e4b5
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/Flags.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{-# OPTIONS_GHC -Wall #-}
module Flags where

import Control.Applicative ((<|>), many, optional)
import Control.Applicative (many, optional)
import Control.Monad.Except (liftIO)
import qualified Data.List as List
import Data.Monoid ((<>))
Expand Down Expand Up @@ -70,11 +70,21 @@ flags =
]

capabilities =
foldl1 (<|>)
[ Opt.switch (Opt.long "prepublish") *> pure BM.None
, Opt.switch (Opt.long "prepublish-core") *> pure BM.Effects
, pure BM.PortsAndEffects
]
setCapabilities
<$> Opt.switch (Opt.long "prepublish")
<*> Opt.switch (Opt.long "prepublish-core")


setCapabilities :: Bool -> Bool -> BM.Permissions
setCapabilities isNormal isCore =
if isCore then
BM.Effects

else if isNormal then
BM.None

else
BM.PortsAndEffects



Expand Down

0 comments on commit 3d4e4b5

Please sign in to comment.