Add new option --force, which forces evaluation results to normal form
This commit is contained in:
parent
6650dd827a
commit
dfe9869472
|
@ -74,7 +74,10 @@ main = do
|
|||
. A.encodingToLazyByteString
|
||||
. toEncodingSorted
|
||||
<=< fromNix
|
||||
| otherwise = liftIO . print
|
||||
| normalize opts =
|
||||
liftIO . print . prettyNixValue <=< normalForm
|
||||
| otherwise =
|
||||
liftIO . print
|
||||
|
||||
if | evaluate opts, verbose opts >= Debug ->
|
||||
runLazyM opts $ evaluateExpression mpath
|
||||
|
|
|
@ -14,6 +14,7 @@ data Options = Options
|
|||
, parseOnly :: Bool
|
||||
, findFile :: Maybe FilePath
|
||||
, strict :: Bool
|
||||
, normalize :: Bool
|
||||
, evaluate :: Bool
|
||||
, json :: Bool
|
||||
, xml :: Bool
|
||||
|
@ -39,6 +40,7 @@ defaultOptions = Options
|
|||
, parseOnly = False
|
||||
, findFile = Nothing
|
||||
, strict = False
|
||||
, normalize = False
|
||||
, evaluate = False
|
||||
, json = False
|
||||
, xml = False
|
||||
|
@ -103,6 +105,9 @@ nixOptions = Options
|
|||
<*> switch
|
||||
( long "strict"
|
||||
<> help "When used with --eval, recursively evaluate list elements and attributes")
|
||||
<*> switch
|
||||
( long "force"
|
||||
<> help "Whether to force the results of evaluation to normal form")
|
||||
<*> switch
|
||||
( long "eval"
|
||||
<> help "Whether to evaluate, or just pretty-print")
|
||||
|
|
Loading…
Reference in a new issue