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
|
2023-01-24 18:15:24 +03:00
|
|
|
{ _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
|
2023-01-24 18:15:24 +03:00
|
|
|
_scopeWithComments <-
|
2022-09-14 17:16:15 +03:00
|
|
|
switch
|
2023-01-24 18:15:24 +03:00
|
|
|
( 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
|
2023-01-24 18:15:24 +03:00
|
|
|
project (g, _) =
|
2022-09-14 17:16:15 +03:00
|
|
|
Scoper.defaultOptions
|
|
|
|
{ Scoper._optShowNameIds = g ^. globalShowNameIds,
|
2022-10-18 18:38:31 +03:00
|
|
|
Scoper._optNoApe = g ^. globalNoApe
|
2022-09-14 17:16:15 +03:00
|
|
|
}
|