1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-22 14:21:30 +03:00
juvix/app/Commands/Dev/Scope/Options.hs

37 lines
930 B
Haskell
Raw Normal View History

2022-09-14 17:16:15 +03:00
module Commands.Dev.Scope.Options where
import CommonOptions
import GlobalOptions
import Juvix.Compiler.Concrete.Pretty qualified as Scoper
data ScopeOptions = ScopeOptions
{ _scopeInputFile :: AppPath File,
_scopeWithComments :: Bool,
_scopeListComments :: Bool
2022-09-14 17:16:15 +03:00
}
deriving stock (Data)
makeLenses ''ScopeOptions
parseScope :: Parser ScopeOptions
parseScope = do
_scopeWithComments <-
2022-09-14 17:16:15 +03:00
switch
( long "with-comments"
<> help "Include user comments when printing code"
)
_scopeListComments <-
switch
( long "list-comments"
<> help "List the user comments"
2022-09-14 17:16:15 +03:00
)
_scopeInputFile <- parseInputJuvixFile
pure ScopeOptions {..}
instance CanonicalProjection (GlobalOptions, ScopeOptions) Scoper.Options where
project (g, _) =
2022-09-14 17:16:15 +03:00
Scoper.defaultOptions
{ Scoper._optShowNameIds = g ^. globalShowNameIds,
Scoper._optNoApe = g ^. globalNoApe
2022-09-14 17:16:15 +03:00
}