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
|
|
|
|
{ _scopeInlineImports :: Bool,
|
|
|
|
_scopeInputFile :: Path
|
|
|
|
}
|
|
|
|
deriving stock (Data)
|
|
|
|
|
|
|
|
makeLenses ''ScopeOptions
|
|
|
|
|
|
|
|
parseScope :: Parser ScopeOptions
|
|
|
|
parseScope = do
|
|
|
|
_scopeInlineImports <-
|
|
|
|
switch
|
|
|
|
( long "inline-imports"
|
|
|
|
<> help "Show the code of imported modules next to the import statement"
|
|
|
|
)
|
|
|
|
_scopeInputFile <- parseInputJuvixFile
|
|
|
|
pure ScopeOptions {..}
|
|
|
|
|
|
|
|
instance CanonicalProjection (GlobalOptions, ScopeOptions) Scoper.Options where
|
|
|
|
project (g, ScopeOptions {..}) =
|
|
|
|
Scoper.defaultOptions
|
|
|
|
{ Scoper._optShowNameIds = g ^. globalShowNameIds,
|
2022-10-18 18:38:31 +03:00
|
|
|
Scoper._optInlineImports = _scopeInlineImports,
|
|
|
|
Scoper._optNoApe = g ^. globalNoApe
|
2022-09-14 17:16:15 +03:00
|
|
|
}
|