src/Nix/Options/Parser.hs: m upd alignment
This commit is contained in:
parent
38215317b9
commit
2dc211314e
|
@ -28,25 +28,31 @@ argPair = option $ str >>= \s -> case Text.findIndex (== '=') s of
|
|||
nixOptions :: UTCTime -> Parser Options
|
||||
nixOptions current =
|
||||
Options
|
||||
<$> (fromMaybe Informational <$> optional
|
||||
<$> (fromMaybe Informational <$>
|
||||
optional
|
||||
(option
|
||||
|
||||
(do
|
||||
a <- str
|
||||
if all isDigit a
|
||||
then pure $ decodeVerbosity (read a)
|
||||
else fail "Argument to -v/--verbose must be a number"
|
||||
)
|
||||
(short 'v' <> long "verbose" <> help "Verbose output")
|
||||
|
||||
( short 'v'
|
||||
<> long "verbose"
|
||||
<> help "Verbose output"
|
||||
)
|
||||
|
||||
)
|
||||
)
|
||||
<*> switch
|
||||
( long "trace"
|
||||
<> help
|
||||
"Enable tracing code (even more can be seen if built with --flags=tracing)"
|
||||
<> help "Enable tracing code (even more can be seen if built with --flags=tracing)"
|
||||
)
|
||||
<*> switch
|
||||
(long "thunks" <> help
|
||||
"Enable reporting of thunk tracing as well as regular evaluation"
|
||||
( long "thunks"
|
||||
<> help "Enable reporting of thunk tracing as well as regular evaluation"
|
||||
)
|
||||
<*> switch
|
||||
( long "values"
|
||||
|
@ -59,17 +65,16 @@ nixOptions current =
|
|||
<*> optional
|
||||
(strOption
|
||||
( long "reduce"
|
||||
<> help
|
||||
"When done evaluating, output the evaluated part of the expression to FILE"
|
||||
<> help "When done evaluating, output the evaluated part of the expression to FILE"
|
||||
)
|
||||
)
|
||||
<*> switch
|
||||
(long "reduce-sets" <> help
|
||||
"Reduce set members that aren't used; breaks if hasAttr is used"
|
||||
( long "reduce-sets"
|
||||
<> help "Reduce set members that aren't used; breaks if hasAttr is used"
|
||||
)
|
||||
<*> switch
|
||||
(long "reduce-lists" <> help
|
||||
"Reduce list members that aren't used; breaks if elemAt is used"
|
||||
( long "reduce-lists"
|
||||
<> help "Reduce list members that aren't used; breaks if elemAt is used"
|
||||
)
|
||||
<*> switch
|
||||
( long "parse"
|
||||
|
@ -79,7 +84,10 @@ nixOptions current =
|
|||
( long "parse-only"
|
||||
<> help "Whether to parse only, no pretty printing or checking"
|
||||
)
|
||||
<*> switch (long "find" <> help "If selected, find paths within attr trees")
|
||||
<*> switch
|
||||
( long "find"
|
||||
<> help "If selected, find paths within attr trees"
|
||||
)
|
||||
<*> optional
|
||||
(strOption
|
||||
( long "find-file"
|
||||
|
@ -88,10 +96,12 @@ nixOptions current =
|
|||
)
|
||||
<*> switch
|
||||
( long "strict"
|
||||
<> help
|
||||
"When used with --eval, recursively evaluate list elements and attributes"
|
||||
<> help "When used with --eval, recursively evaluate list elements and attributes"
|
||||
)
|
||||
<*> switch
|
||||
( long "eval"
|
||||
<> help "Whether to evaluate, or just pretty-print"
|
||||
)
|
||||
<*> switch (long "eval" <> help "Whether to evaluate, or just pretty-print")
|
||||
<*> switch
|
||||
( long "json"
|
||||
<> help "Print the resulting value as an JSON representation"
|
||||
|
@ -104,14 +114,14 @@ nixOptions current =
|
|||
(strOption
|
||||
( short 'A'
|
||||
<> long "attr"
|
||||
<> help
|
||||
"Select an attribute from the top-level Nix expression being evaluated"
|
||||
<> help "Select an attribute from the top-level Nix expression being evaluated"
|
||||
)
|
||||
)
|
||||
<*> many
|
||||
(strOption
|
||||
(short 'I' <> long "include" <> help
|
||||
"Add a path to the Nix expression search path"
|
||||
( short 'I'
|
||||
<> long "include"
|
||||
<> help "Add a path to the Nix expression search path"
|
||||
)
|
||||
)
|
||||
<*> switch
|
||||
|
@ -138,11 +148,14 @@ nixOptions current =
|
|||
)
|
||||
<*> optional
|
||||
(strOption
|
||||
(short 'E' <> long "expr" <> help "Expression to parse or evaluate")
|
||||
( short 'E'
|
||||
<> long "expr"
|
||||
<> help "Expression to parse or evaluate")
|
||||
)
|
||||
<*> many
|
||||
(argPair
|
||||
(long "arg" <> help "Argument to pass to an evaluated lambda")
|
||||
( long "arg"
|
||||
<> help "Argument to pass to an evaluated lambda")
|
||||
)
|
||||
<*> many
|
||||
(argPair
|
||||
|
@ -152,16 +165,24 @@ nixOptions current =
|
|||
)
|
||||
<*> optional
|
||||
(strOption
|
||||
(short 'f' <> long "file" <> help
|
||||
"Parse all of the files given in FILE; - means stdin"
|
||||
( short 'f'
|
||||
<> long "file"
|
||||
<> help "Parse all of the files given in FILE; - means stdin"
|
||||
)
|
||||
)
|
||||
<*> option
|
||||
(parseTimeOrError True defaultTimeLocale "%Y/%m/%d %H:%M:%S" <$> str)
|
||||
(long "now" <> value current <> help
|
||||
"Set current time for testing purposes"
|
||||
( long "now"
|
||||
<> value current
|
||||
<> help "Set current time for testing purposes"
|
||||
)
|
||||
<*> many (strArgument (metavar "FILE" <> help "Path of file to parse"))
|
||||
<*> many
|
||||
(strArgument
|
||||
( metavar "FILE"
|
||||
<> help "Path of file to parse"
|
||||
)
|
||||
)
|
||||
|
||||
versionOpt :: Parser (a -> a)
|
||||
versionOpt = infoOption
|
||||
(showVersion version)
|
||||
|
|
Loading…
Reference in a new issue