1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-14 08:27:03 +03:00
juvix/app/GlobalOptions.hs
janmasrovira 50ea7373ee
Improve error generation and handling (#108)
* add face and handling of not in scope symbol error

* small fix

* generic errors wip

* add App effect

* format

* add flycheck-minijuvix

* use absolute paths and refactor

* fix dir0

* add generic error instances and improve some errors

* format

* qualify strings

* use AnsiText

* add ToGenericError instances for the type checker errors

* improve error message

* improve handling of parsing errors
2022-05-18 17:10:10 +02:00

34 lines
790 B
Haskell

{-# LANGUAGE ApplicativeDo #-}
module GlobalOptions where
import MiniJuvix.Prelude
import Options.Applicative
data GlobalOptions = GlobalOptions
{ _globalNoColors :: Bool,
_globalShowNameIds :: Bool,
_globalOnlyErrors :: Bool
}
makeLenses ''GlobalOptions
parseGlobalOptions :: Parser GlobalOptions
parseGlobalOptions = do
_globalNoColors <-
switch
( long "no-colors"
<> help "Disable globally ANSI formatting"
)
_globalShowNameIds <-
switch
( long "show-name-ids"
<> help "Show the unique number of each identifier when pretty printing"
)
_globalOnlyErrors <-
switch
( long "only-errors"
<> help "Only print errors in a uniform format (used by minijuvix-mode)"
)
pure GlobalOptions {..}