Copyright | (c) Soostone Inc 2020 |
---|---|
License | AllRightsReserved |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Napkin Command Line Interface, CLI
Synopsis
- data CliOptions
- data DumpOptions = DumpOptions {}
- data RunOptions = RunOptions {
- _runOptions_disableAll :: Bool
- _runOptions_enableAll :: Bool
- _runOptions_depsOnly :: Bool
- _runOptions_forceTables :: [Ref Table]
- _runOptions_skipTables :: [Ref Table]
- _runOptions_naturalUpdates :: [Ref Table]
- _runOptions_app :: Text
- _runOptions_logLevel :: Maybe Severity
- _runOptions_dryRun :: Bool
- _runOptions_namespace :: Maybe Text
- _runOptions_metadataConnectionString :: Maybe Text
- _runOptions_showProgress :: Bool
- _runOptions_meta :: [ByteString]
- _runOptions_enableTags :: [TableSpecTag]
- _runOptions_disableTags :: [TableSpecTag]
- newtype CustomSpecPreprocessor bk = CustomSpecPreprocessor (SpecMetaArgs -> SpecRuntime bk -> Specs bk -> Specs bk)
- parseRunOptions :: Parser CliOptions
- parseDumpOptions :: Parser CliOptions
- parseCliOption :: Parser CliOptions
- parseSpecMetaArgs :: [ByteString] -> Either String SpecMetaArgs
- dumpDeps :: forall bk a. (ReifiesBackend bk, MustacheBackend bk, RunBackendEffect bk, Show (BackendTableMeta bk), Show (BackendViewMeta bk), Show (BackendMaterializedViewMeta bk)) => RuntimeEnv -> ExternMacros -> bk -> Spec bk a -> IO ()
- compileSpecs :: MonadIO m => [(t, Spec b a)] -> m [(t, Specs b)]
- specMain :: SpecBackend bk drop t1 t2 t3 t4 t5 t6 t7 t8 t9 => bk -> SpecRuntime bk -> Spec bk a -> IO ExitCode
- specMainWith :: forall bk drop t1 t2 t3 t4 t5 t6 t7 t8 t9 a. SpecBackend bk drop t1 t2 t3 t4 t5 t6 t7 t8 t9 => (AppConfig -> ResourceT IO ComboEnv) -> CliOptions -> bk -> CustomSpecPreprocessor bk -> CustomValidator -> ExternMacros -> SpecRuntime bk -> Spec bk a -> IO ExitCode
- specMainWithInterpreter :: forall bk drop t1 t2 t3 t4 t5 t6 t7 t8 t9 a. SpecBackend bk drop t1 t2 t3 t4 t5 t6 t7 t8 t9 => RuntimeEnv -> (AppConfig -> ResourceT IO ComboEnv) -> CliOptions -> bk -> CustomSpecPreprocessor bk -> CustomValidator -> ExternMacros -> SpecRuntime bk -> Spec bk a -> IO ExitCode
- exitRunFailed :: ExitCode
- exitValidationFailed :: ExitCode
- specTagRefMap :: [TableSpec b] -> Map (Maybe TableSpecTag) [Ref Table]
Documentation
data CliOptions #
Data structure for all CLI commnad and sub-commands.
SubCommand data strucres are Run, Dump, ListTags, DumpDeps Each SubCommands data strucures contain the available commands
Instances
Eq CliOptions # | |
Defined in Napkin.Spec.Cli (==) :: CliOptions -> CliOptions -> Bool # (/=) :: CliOptions -> CliOptions -> Bool # | |
Show CliOptions # | |
Defined in Napkin.Spec.Cli showsPrec :: Int -> CliOptions -> ShowS # show :: CliOptions -> String # showList :: [CliOptions] -> ShowS # |
data DumpOptions #
Data structure dump sub-command.
Instances
Eq DumpOptions # | |
Defined in Napkin.Spec.Cli (==) :: DumpOptions -> DumpOptions -> Bool # (/=) :: DumpOptions -> DumpOptions -> Bool # | |
Show DumpOptions # | |
Defined in Napkin.Spec.Cli showsPrec :: Int -> DumpOptions -> ShowS # show :: DumpOptions -> String # showList :: [DumpOptions] -> ShowS # |
data RunOptions #
Data structure run sub-command.
Instances
Eq RunOptions # | |
Defined in Napkin.Spec.Cli (==) :: RunOptions -> RunOptions -> Bool # (/=) :: RunOptions -> RunOptions -> Bool # | |
Show RunOptions # | |
Defined in Napkin.Spec.Cli showsPrec :: Int -> RunOptions -> ShowS # show :: RunOptions -> String # showList :: [RunOptions] -> ShowS # |
newtype CustomSpecPreprocessor bk #
User-specified function to preprocess all specs. Useful for renaming all tables, for example, in development vs. production mode.
CustomSpecPreprocessor (SpecMetaArgs -> SpecRuntime bk -> Specs bk -> Specs bk) |
Instances
Default (CustomSpecPreprocessor bk) # | |
Defined in Napkin.Spec.Cli def :: CustomSpecPreprocessor bk # |
parseRunOptions :: Parser CliOptions #
Parser for the run
CLI sub-command
Parses available commands for the run
sub-command and provides detail CLI help text
parseDumpOptions :: Parser CliOptions #
Parser for the dump
CLI sub-command
Parses available commands for the run
sub-command and provides detail CLI help text
parseSpecMetaArgs :: [ByteString] -> Either String SpecMetaArgs #
dumpDeps :: forall bk a. (ReifiesBackend bk, MustacheBackend bk, RunBackendEffect bk, Show (BackendTableMeta bk), Show (BackendViewMeta bk), Show (BackendMaterializedViewMeta bk)) => RuntimeEnv -> ExternMacros -> bk -> Spec bk a -> IO () #
compileSpecs :: MonadIO m => [(t, Spec b a)] -> m [(t, Specs b)] #
Compile given list of specs into ready to execute form.
specMain :: SpecBackend bk drop t1 t2 t3 t4 t5 t6 t7 t8 t9 => bk -> SpecRuntime bk -> Spec bk a -> IO ExitCode #
Use this to make your main
entry point for your spec running
application.
specMain :: bk -> [(NS.SpecRuntime bk, NST.Spec bk ())] -> IO ()
:: forall bk drop t1 t2 t3 t4 t5 t6 t7 t8 t9 a. SpecBackend bk drop t1 t2 t3 t4 t5 t6 t7 t8 t9 | |
=> (AppConfig -> ResourceT IO ComboEnv) | How to build the combo. register any cleanup |
-> CliOptions | |
-> bk | |
-> CustomSpecPreprocessor bk | |
-> CustomValidator | |
-> ExternMacros | |
-> SpecRuntime bk | |
-> Spec bk a | |
-> IO ExitCode |
A more customizable specMain for embedding in larger programs. This API is unstable
:: forall bk drop t1 t2 t3 t4 t5 t6 t7 t8 t9 a. SpecBackend bk drop t1 t2 t3 t4 t5 t6 t7 t8 t9 | |
=> RuntimeEnv | |
-> (AppConfig -> ResourceT IO ComboEnv) | How to build the combo. register any cleanup |
-> CliOptions | |
-> bk | |
-> CustomSpecPreprocessor bk | |
-> CustomValidator | |
-> ExternMacros | |
-> SpecRuntime bk | |
-> Spec bk a | |
-> IO ExitCode |
specTagRefMap :: [TableSpec b] -> Map (Maybe TableSpecTag) [Ref Table] #
create a mapping of TableSpecTag
s to `Ref Table`s for dumping.