2022-07-12 20:08:03 +03:00
|
|
|
module Commands.Internal.Scope where
|
2022-05-06 12:48:07 +03:00
|
|
|
|
2022-07-12 20:08:03 +03:00
|
|
|
import GlobalOptions
|
2022-07-08 14:59:45 +03:00
|
|
|
import Juvix.Prelude hiding (Doc)
|
2022-07-12 20:08:03 +03:00
|
|
|
import Juvix.Syntax.Concrete.Scoped.Pretty qualified as Scoper
|
2022-05-06 12:48:07 +03:00
|
|
|
import Options.Applicative
|
|
|
|
|
2022-06-09 17:36:07 +03:00
|
|
|
newtype ScopeOptions = ScopeOptions
|
|
|
|
{ _scopeInlineImports :: Bool
|
2022-05-06 12:48:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
makeLenses ''ScopeOptions
|
|
|
|
|
|
|
|
parseScope :: Parser ScopeOptions
|
|
|
|
parseScope = do
|
|
|
|
_scopeInlineImports <-
|
|
|
|
switch
|
|
|
|
( long "inline-imports"
|
|
|
|
<> help "Show the code of imported modules next to the import statement"
|
|
|
|
)
|
|
|
|
pure ScopeOptions {..}
|
2022-07-12 20:08:03 +03:00
|
|
|
|
|
|
|
mkScopePrettyOptions :: GlobalOptions -> ScopeOptions -> Scoper.Options
|
|
|
|
mkScopePrettyOptions g ScopeOptions {..} =
|
|
|
|
Scoper.defaultOptions
|
|
|
|
{ Scoper._optShowNameIds = g ^. globalShowNameIds,
|
|
|
|
Scoper._optInlineImports = _scopeInlineImports
|
|
|
|
}
|