| Copyright | (c) Soostone Inc 2020 |
|---|---|
| License | AllRightsReserved |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | Safe-Inferred |
| Language | GHC2021 |
Napkin.Spec.Cli
Description
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 :: [SpecTableName]
- _runOptions_skipTables :: [SpecTableName]
- _runOptions_naturalUpdates :: [SpecTableName]
- _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]
- _runOptions_condensedLogging :: CondensedLogging
- _runOptions_maxConcurrency :: Maybe Natural
- 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. (MustacheBackend bk, RunBackendEffect bk, DumpBackendRequirements bk) => RuntimeEnv -> ExternMacros -> bk -> Spec bk a -> IO ()
- specMain :: SpecBackend bk => bk -> SpecRuntime bk -> Spec bk a -> IO ExitCode
- specMainWith :: forall bk a. SpecBackend bk => (AppConfig -> ResourceT IO (ComboEnv bk)) -> CliOptions -> bk -> CustomSpecPreprocessor bk -> CustomValidator -> ExternMacros -> SpecRuntime bk -> Spec bk a -> IO ExitCode
- specMainWithInterpreter :: forall bk a. SpecBackend bk => RuntimeEnv -> (AppConfig -> ResourceT IO (ComboEnv bk)) -> CliOptions -> bk -> CustomSpecPreprocessor bk -> CustomValidator -> ExternMacros -> SpecRuntime bk -> Spec bk a -> IO ExitCode
- exitRunFailed :: ExitCode
- exitValidationFailed :: ExitCode
- specTagRefMap :: [TableSpec b] -> Map (Maybe TableSpecTag) [SpecTableName]
- specListTags :: forall bk m. (SpecBackend bk, MonadIO m) => Specs bk -> m ()
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
Constructors
| Run RunOptions | |
| Dump DumpOptions | |
| ListTags | |
| DumpDeps |
Instances
| Show CliOptions # | |
Defined in Napkin.Spec.Cli Methods showsPrec :: Int -> CliOptions -> ShowS # show :: CliOptions -> String # showList :: [CliOptions] -> ShowS # | |
| Eq CliOptions # | |
Defined in Napkin.Spec.Cli | |
data DumpOptions #
Data structure dump sub-command.
Constructors
| DumpOptions | |
Instances
| Show DumpOptions # | |
Defined in Napkin.Spec.Cli Methods showsPrec :: Int -> DumpOptions -> ShowS # show :: DumpOptions -> String # showList :: [DumpOptions] -> ShowS # | |
| Eq DumpOptions # | |
Defined in Napkin.Spec.Cli | |
data RunOptions #
Data structure run sub-command.
Constructors
Instances
| Show RunOptions # | |
Defined in Napkin.Spec.Cli Methods showsPrec :: Int -> RunOptions -> ShowS # show :: RunOptions -> String # showList :: [RunOptions] -> ShowS # | |
| Eq RunOptions # | |
Defined in Napkin.Spec.Cli | |
newtype CustomSpecPreprocessor bk #
User-specified function to preprocess all specs. Useful for renaming all tables, for example, in development vs. production mode.
Constructors
| CustomSpecPreprocessor (SpecMetaArgs -> SpecRuntime bk -> Specs bk -> Specs bk) |
Instances
| Default (CustomSpecPreprocessor bk) # | |
Defined in Napkin.Spec.Cli Methods 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. (MustacheBackend bk, RunBackendEffect bk, DumpBackendRequirements bk) => RuntimeEnv -> ExternMacros -> bk -> Spec bk a -> IO () #
specMain :: SpecBackend bk => 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 ()
Arguments
| :: forall bk a. SpecBackend bk | |
| => (AppConfig -> ResourceT IO (ComboEnv bk)) | 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
Arguments
| :: forall bk a. SpecBackend bk | |
| => RuntimeEnv | |
| -> (AppConfig -> ResourceT IO (ComboEnv bk)) | 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) [SpecTableName] #
create a mapping of TableSpecTags to `Ref Table`s for dumping.
specListTags :: forall bk m. (SpecBackend bk, MonadIO m) => Specs bk -> m () #
Print the result of specTagRefMap'ing a particular spec to terminal.