module Nix.Options.Parser where import Control.Arrow ( second ) import Data.Char ( isDigit ) import Data.Maybe ( fromMaybe ) import Data.Text ( Text ) import qualified Data.Text as Text import Data.Time import Nix.Options import Options.Applicative hiding ( ParserResult(..) ) decodeVerbosity :: Int -> Verbosity decodeVerbosity :: Int -> Verbosity decodeVerbosity 0 = Verbosity ErrorsOnly decodeVerbosity 1 = Verbosity Informational decodeVerbosity 2 = Verbosity Talkative decodeVerbosity 3 = Verbosity Chatty decodeVerbosity 4 = Verbosity DebugInfo decodeVerbosity _ = Verbosity Vomit argPair :: Mod OptionFields (Text, Text) -> Parser (Text, Text) argPair :: Mod OptionFields (Text, Text) -> Parser (Text, Text) argPair = ReadM (Text, Text) -> Mod OptionFields (Text, Text) -> Parser (Text, Text) forall a. ReadM a -> Mod OptionFields a -> Parser a option (ReadM (Text, Text) -> Mod OptionFields (Text, Text) -> Parser (Text, Text)) -> ReadM (Text, Text) -> Mod OptionFields (Text, Text) -> Parser (Text, Text) forall a b. (a -> b) -> a -> b $ ReadM Text forall s. IsString s => ReadM s str ReadM Text -> (Text -> ReadM (Text, Text)) -> ReadM (Text, Text) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b >>= \s :: Text s -> case (Char -> Bool) -> Text -> Maybe Int Text.findIndex (Char -> Char -> Bool forall a. Eq a => a -> a -> Bool == '=') Text s of Nothing -> [Char] -> ReadM (Text, Text) forall a. [Char] -> a errorWithoutStackTrace "Format of --arg/--argstr in hnix is: name=expr" Just i :: Int i -> (Text, Text) -> ReadM (Text, Text) forall (m :: * -> *) a. Monad m => a -> m a return ((Text, Text) -> ReadM (Text, Text)) -> (Text, Text) -> ReadM (Text, Text) forall a b. (a -> b) -> a -> b $ (Text -> Text) -> (Text, Text) -> (Text, Text) forall (a :: * -> * -> *) b c d. Arrow a => a b c -> a (d, b) (d, c) second Text -> Text Text.tail ((Text, Text) -> (Text, Text)) -> (Text, Text) -> (Text, Text) forall a b. (a -> b) -> a -> b $ Int -> Text -> (Text, Text) Text.splitAt Int i Text s nixOptions :: UTCTime -> Parser Options nixOptions :: UTCTime -> Parser Options nixOptions current :: UTCTime current = Verbosity -> Bool -> Bool -> Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options Options (Verbosity -> Bool -> Bool -> Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser Verbosity -> Parser (Bool -> Bool -> Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> (Verbosity -> Maybe Verbosity -> Verbosity forall a. a -> Maybe a -> a fromMaybe Verbosity Informational (Maybe Verbosity -> Verbosity) -> Parser (Maybe Verbosity) -> Parser Verbosity forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Parser Verbosity -> Parser (Maybe Verbosity) forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a) optional (ReadM Verbosity -> Mod OptionFields Verbosity -> Parser Verbosity forall a. ReadM a -> Mod OptionFields a -> Parser a option (do [Char] a <- ReadM [Char] forall s. IsString s => ReadM s str if (Char -> Bool) -> [Char] -> Bool forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool all Char -> Bool isDigit [Char] a then Verbosity -> ReadM Verbosity forall (f :: * -> *) a. Applicative f => a -> f a pure (Verbosity -> ReadM Verbosity) -> Verbosity -> ReadM Verbosity forall a b. (a -> b) -> a -> b $ Int -> Verbosity decodeVerbosity ([Char] -> Int forall a. Read a => [Char] -> a read [Char] a) else [Char] -> ReadM Verbosity forall (m :: * -> *) a. MonadFail m => [Char] -> m a fail "Argument to -v/--verbose must be a number" ) (Char -> Mod OptionFields Verbosity forall (f :: * -> *) a. HasName f => Char -> Mod f a short 'v' Mod OptionFields Verbosity -> Mod OptionFields Verbosity -> Mod OptionFields Verbosity forall a. Semigroup a => a -> a -> a <> [Char] -> Mod OptionFields Verbosity forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "verbose" Mod OptionFields Verbosity -> Mod OptionFields Verbosity -> Mod OptionFields Verbosity forall a. Semigroup a => a -> a -> a <> [Char] -> Mod OptionFields Verbosity forall (f :: * -> *) a. [Char] -> Mod f a help "Verbose output") ) ) Parser (Bool -> Bool -> Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser Bool -> Parser (Bool -> Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Mod FlagFields Bool -> Parser Bool switch ( [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "trace" Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool forall a. Semigroup a => a -> a -> a <> [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. [Char] -> Mod f a help "Enable tracing code (even more can be seen if built with --flags=tracing)" ) Parser (Bool -> Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser Bool -> Parser (Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Mod FlagFields Bool -> Parser Bool switch ([Char] -> Mod FlagFields Bool forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "thunks" Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool forall a. Semigroup a => a -> a -> a <> [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. [Char] -> Mod f a help "Enable reporting of thunk tracing as well as regular evaluation" ) Parser (Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser Bool -> Parser (Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Mod FlagFields Bool -> Parser Bool switch ( [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "values" Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool forall a. Semigroup a => a -> a -> a <> [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. [Char] -> Mod f a help "Enable reporting of value provenance in error messages" ) Parser (Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser Bool -> Parser (Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Mod FlagFields Bool -> Parser Bool switch ( [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "scopes" Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool forall a. Semigroup a => a -> a -> a <> [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. [Char] -> Mod f a help "Enable reporting of scopes in evaluation traces" ) Parser (Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser (Maybe [Char]) -> Parser (Bool -> Bool -> Bool -> Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Parser [Char] -> Parser (Maybe [Char]) forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a) optional (Mod OptionFields [Char] -> Parser [Char] forall s. IsString s => Mod OptionFields s -> Parser s strOption ( [Char] -> Mod OptionFields [Char] forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "reduce" Mod OptionFields [Char] -> Mod OptionFields [Char] -> Mod OptionFields [Char] forall a. Semigroup a => a -> a -> a <> [Char] -> Mod OptionFields [Char] forall (f :: * -> *) a. [Char] -> Mod f a help "When done evaluating, output the evaluated part of the expression to FILE" ) ) Parser (Bool -> Bool -> Bool -> Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser Bool -> Parser (Bool -> Bool -> Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Mod FlagFields Bool -> Parser Bool switch ([Char] -> Mod FlagFields Bool forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "reduce-sets" Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool forall a. Semigroup a => a -> a -> a <> [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. [Char] -> Mod f a help "Reduce set members that aren't used; breaks if hasAttr is used" ) Parser (Bool -> Bool -> Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser Bool -> Parser (Bool -> Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Mod FlagFields Bool -> Parser Bool switch ([Char] -> Mod FlagFields Bool forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "reduce-lists" Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool forall a. Semigroup a => a -> a -> a <> [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. [Char] -> Mod f a help "Reduce list members that aren't used; breaks if elemAt is used" ) Parser (Bool -> Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser Bool -> Parser (Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Mod FlagFields Bool -> Parser Bool switch ( [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "parse" Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool forall a. Semigroup a => a -> a -> a <> [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. [Char] -> Mod f a help "Whether to parse the file (also the default right now)" ) Parser (Bool -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser Bool -> Parser (Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Mod FlagFields Bool -> Parser Bool switch ( [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "parse-only" Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool forall a. Semigroup a => a -> a -> a <> [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. [Char] -> Mod f a help "Whether to parse only, no pretty printing or checking" ) Parser (Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser Bool -> Parser (Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Mod FlagFields Bool -> Parser Bool switch ([Char] -> Mod FlagFields Bool forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "find" Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool forall a. Semigroup a => a -> a -> a <> [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. [Char] -> Mod f a help "If selected, find paths within attr trees") Parser (Maybe [Char] -> Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser (Maybe [Char]) -> Parser (Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Parser [Char] -> Parser (Maybe [Char]) forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a) optional (Mod OptionFields [Char] -> Parser [Char] forall s. IsString s => Mod OptionFields s -> Parser s strOption ( [Char] -> Mod OptionFields [Char] forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "find-file" Mod OptionFields [Char] -> Mod OptionFields [Char] -> Mod OptionFields [Char] forall a. Semigroup a => a -> a -> a <> [Char] -> Mod OptionFields [Char] forall (f :: * -> *) a. [Char] -> Mod f a help "Look up the given files in Nix's search path" ) ) Parser (Bool -> Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser Bool -> Parser (Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Mod FlagFields Bool -> Parser Bool switch ( [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "strict" Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool forall a. Semigroup a => a -> a -> a <> [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. [Char] -> Mod f a help "When used with --eval, recursively evaluate list elements and attributes" ) Parser (Bool -> Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser Bool -> Parser (Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Mod FlagFields Bool -> Parser Bool switch ([Char] -> Mod FlagFields Bool forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "eval" Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool forall a. Semigroup a => a -> a -> a <> [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. [Char] -> Mod f a help "Whether to evaluate, or just pretty-print") Parser (Bool -> Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser Bool -> Parser (Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Mod FlagFields Bool -> Parser Bool switch ( [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "json" Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool forall a. Semigroup a => a -> a -> a <> [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. [Char] -> Mod f a help "Print the resulting value as an JSON representation" ) Parser (Bool -> Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser Bool -> Parser (Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Mod FlagFields Bool -> Parser Bool switch ( [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "xml" Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool forall a. Semigroup a => a -> a -> a <> [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. [Char] -> Mod f a help "Print the resulting value as an XML representation" ) Parser (Maybe Text -> [[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser (Maybe Text) -> Parser ([[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Parser Text -> Parser (Maybe Text) forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a) optional (Mod OptionFields Text -> Parser Text forall s. IsString s => Mod OptionFields s -> Parser s strOption ( Char -> Mod OptionFields Text forall (f :: * -> *) a. HasName f => Char -> Mod f a short 'A' Mod OptionFields Text -> Mod OptionFields Text -> Mod OptionFields Text forall a. Semigroup a => a -> a -> a <> [Char] -> Mod OptionFields Text forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "attr" Mod OptionFields Text -> Mod OptionFields Text -> Mod OptionFields Text forall a. Semigroup a => a -> a -> a <> [Char] -> Mod OptionFields Text forall (f :: * -> *) a. [Char] -> Mod f a help "Select an attribute from the top-level Nix expression being evaluated" ) ) Parser ([[Char]] -> Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser [[Char]] -> Parser (Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Parser [Char] -> Parser [[Char]] forall (f :: * -> *) a. Alternative f => f a -> f [a] many (Mod OptionFields [Char] -> Parser [Char] forall s. IsString s => Mod OptionFields s -> Parser s strOption (Char -> Mod OptionFields [Char] forall (f :: * -> *) a. HasName f => Char -> Mod f a short 'I' Mod OptionFields [Char] -> Mod OptionFields [Char] -> Mod OptionFields [Char] forall a. Semigroup a => a -> a -> a <> [Char] -> Mod OptionFields [Char] forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "include" Mod OptionFields [Char] -> Mod OptionFields [Char] -> Mod OptionFields [Char] forall a. Semigroup a => a -> a -> a <> [Char] -> Mod OptionFields [Char] forall (f :: * -> *) a. [Char] -> Mod f a help "Add a path to the Nix expression search path" ) ) Parser (Bool -> Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser Bool -> Parser (Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Mod FlagFields Bool -> Parser Bool switch ( [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "check" Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool forall a. Semigroup a => a -> a -> a <> [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. [Char] -> Mod f a help "Whether to check for syntax errors after parsing" ) Parser (Maybe [Char] -> Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser (Maybe [Char]) -> Parser (Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Parser [Char] -> Parser (Maybe [Char]) forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a) optional (Mod OptionFields [Char] -> Parser [Char] forall s. IsString s => Mod OptionFields s -> Parser s strOption ( [Char] -> Mod OptionFields [Char] forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "read" Mod OptionFields [Char] -> Mod OptionFields [Char] -> Mod OptionFields [Char] forall a. Semigroup a => a -> a -> a <> [Char] -> Mod OptionFields [Char] forall (f :: * -> *) a. [Char] -> Mod f a help "Read in an expression tree from a binary cache" ) ) Parser (Bool -> Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser Bool -> Parser (Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Mod FlagFields Bool -> Parser Bool switch ( [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "cache" Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool forall a. Semigroup a => a -> a -> a <> [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. [Char] -> Mod f a help "Write out the parsed expression tree to a binary cache" ) Parser (Bool -> Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser Bool -> Parser (Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Mod FlagFields Bool -> Parser Bool switch ( [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "repl" Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool forall a. Semigroup a => a -> a -> a <> [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. [Char] -> Mod f a help "After performing any indicated actions, enter the REPL" ) Parser (Bool -> Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser Bool -> Parser (Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Mod FlagFields Bool -> Parser Bool switch ( [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "ignore-errors" Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool forall a. Semigroup a => a -> a -> a <> [Char] -> Mod FlagFields Bool forall (f :: * -> *) a. [Char] -> Mod f a help "Continue parsing files, even if there are errors" ) Parser (Maybe Text -> [(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser (Maybe Text) -> Parser ([(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Parser Text -> Parser (Maybe Text) forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a) optional (Mod OptionFields Text -> Parser Text forall s. IsString s => Mod OptionFields s -> Parser s strOption (Char -> Mod OptionFields Text forall (f :: * -> *) a. HasName f => Char -> Mod f a short 'E' Mod OptionFields Text -> Mod OptionFields Text -> Mod OptionFields Text forall a. Semigroup a => a -> a -> a <> [Char] -> Mod OptionFields Text forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "expr" Mod OptionFields Text -> Mod OptionFields Text -> Mod OptionFields Text forall a. Semigroup a => a -> a -> a <> [Char] -> Mod OptionFields Text forall (f :: * -> *) a. [Char] -> Mod f a help "Expression to parse or evaluate") ) Parser ([(Text, Text)] -> [(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser [(Text, Text)] -> Parser ([(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Parser (Text, Text) -> Parser [(Text, Text)] forall (f :: * -> *) a. Alternative f => f a -> f [a] many (Mod OptionFields (Text, Text) -> Parser (Text, Text) argPair ([Char] -> Mod OptionFields (Text, Text) forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "arg" Mod OptionFields (Text, Text) -> Mod OptionFields (Text, Text) -> Mod OptionFields (Text, Text) forall a. Semigroup a => a -> a -> a <> [Char] -> Mod OptionFields (Text, Text) forall (f :: * -> *) a. [Char] -> Mod f a help "Argument to pass to an evaluated lambda") ) Parser ([(Text, Text)] -> Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser [(Text, Text)] -> Parser (Maybe [Char] -> UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Parser (Text, Text) -> Parser [(Text, Text)] forall (f :: * -> *) a. Alternative f => f a -> f [a] many (Mod OptionFields (Text, Text) -> Parser (Text, Text) argPair ( [Char] -> Mod OptionFields (Text, Text) forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "argstr" Mod OptionFields (Text, Text) -> Mod OptionFields (Text, Text) -> Mod OptionFields (Text, Text) forall a. Semigroup a => a -> a -> a <> [Char] -> Mod OptionFields (Text, Text) forall (f :: * -> *) a. [Char] -> Mod f a help "Argument string to pass to an evaluated lambda" ) ) Parser (Maybe [Char] -> UTCTime -> [[Char]] -> Options) -> Parser (Maybe [Char]) -> Parser (UTCTime -> [[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Parser [Char] -> Parser (Maybe [Char]) forall (f :: * -> *) a. Alternative f => f a -> f (Maybe a) optional (Mod OptionFields [Char] -> Parser [Char] forall s. IsString s => Mod OptionFields s -> Parser s strOption (Char -> Mod OptionFields [Char] forall (f :: * -> *) a. HasName f => Char -> Mod f a short 'f' Mod OptionFields [Char] -> Mod OptionFields [Char] -> Mod OptionFields [Char] forall a. Semigroup a => a -> a -> a <> [Char] -> Mod OptionFields [Char] forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "file" Mod OptionFields [Char] -> Mod OptionFields [Char] -> Mod OptionFields [Char] forall a. Semigroup a => a -> a -> a <> [Char] -> Mod OptionFields [Char] forall (f :: * -> *) a. [Char] -> Mod f a help "Parse all of the files given in FILE; - means stdin" ) ) Parser (UTCTime -> [[Char]] -> Options) -> Parser UTCTime -> Parser ([[Char]] -> Options) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> ReadM UTCTime -> Mod OptionFields UTCTime -> Parser UTCTime forall a. ReadM a -> Mod OptionFields a -> Parser a option (Bool -> TimeLocale -> [Char] -> [Char] -> UTCTime forall t. ParseTime t => Bool -> TimeLocale -> [Char] -> [Char] -> t parseTimeOrError Bool True TimeLocale defaultTimeLocale "%Y/%m/%d %H:%M:%S" ([Char] -> UTCTime) -> ReadM [Char] -> ReadM UTCTime forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> ReadM [Char] forall s. IsString s => ReadM s str) ([Char] -> Mod OptionFields UTCTime forall (f :: * -> *) a. HasName f => [Char] -> Mod f a long "now" Mod OptionFields UTCTime -> Mod OptionFields UTCTime -> Mod OptionFields UTCTime forall a. Semigroup a => a -> a -> a <> UTCTime -> Mod OptionFields UTCTime forall (f :: * -> *) a. HasValue f => a -> Mod f a value UTCTime current Mod OptionFields UTCTime -> Mod OptionFields UTCTime -> Mod OptionFields UTCTime forall a. Semigroup a => a -> a -> a <> [Char] -> Mod OptionFields UTCTime forall (f :: * -> *) a. [Char] -> Mod f a help "Set current time for testing purposes" ) Parser ([[Char]] -> Options) -> Parser [[Char]] -> Parser Options forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Parser [Char] -> Parser [[Char]] forall (f :: * -> *) a. Alternative f => f a -> f [a] many (Mod ArgumentFields [Char] -> Parser [Char] forall s. IsString s => Mod ArgumentFields s -> Parser s strArgument ([Char] -> Mod ArgumentFields [Char] forall (f :: * -> *) a. HasMetavar f => [Char] -> Mod f a metavar "FILE" Mod ArgumentFields [Char] -> Mod ArgumentFields [Char] -> Mod ArgumentFields [Char] forall a. Semigroup a => a -> a -> a <> [Char] -> Mod ArgumentFields [Char] forall (f :: * -> *) a. [Char] -> Mod f a help "Path of file to parse")) nixOptionsInfo :: UTCTime -> ParserInfo Options nixOptionsInfo :: UTCTime -> ParserInfo Options nixOptionsInfo current :: UTCTime current = Parser Options -> InfoMod Options -> ParserInfo Options forall a. Parser a -> InfoMod a -> ParserInfo a info (Parser (Options -> Options) forall a. Parser (a -> a) helper Parser (Options -> Options) -> Parser Options -> Parser Options forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> UTCTime -> Parser Options nixOptions UTCTime current) (InfoMod Options forall a. InfoMod a fullDesc InfoMod Options -> InfoMod Options -> InfoMod Options forall a. Semigroup a => a -> a -> a <> [Char] -> InfoMod Options forall a. [Char] -> InfoMod a progDesc "" InfoMod Options -> InfoMod Options -> InfoMod Options forall a. Semigroup a => a -> a -> a <> [Char] -> InfoMod Options forall a. [Char] -> InfoMod a header "hnix")