iris-0.1.0.0: Haskell CLI framework
Copyright(c) 2022 Dmitrii Kovanikov
LicenseMPL-2.0
MaintainerDmitrii Kovanikov <kovanikov@gmail.com>
StabilityExperimental
PortabilityPortable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Iris.Tool

Description

Utilities to check required tools and their minimal version for a CLI app.

Sometimes, your CLI application

Since: 0.0.0.0

Synopsis

Requiring an executable

need :: MonadIO m => [Tool] -> m () Source #

Use this function to require specific CLI tools for your CLI application.

The function can be used in the beginning of each command in the following way:

app :: App ()
app = Iris.asksCliEnv Iris.cliEnvCmd >>= \case
    Download url -> do
        Iris.need ["curl"]
        runDownload url
    Evaluate hs -> do
        Iris.need ["ghc", "cabal"]
        runEvaluate hs

Throws: ToolCheckException if can't find a tool or if it has wrong version.

Since: 0.0.0.0

data Tool Source #

Since: 0.0.0.0

Constructors

Tool 

Fields

Instances

Instances details
IsString Tool Source #

Since: 0.0.0.0

Instance details

Defined in Iris.Tool

Methods

fromString :: String -> Tool #

data ToolSelector Source #

Since: 0.0.0.0

Constructors

ToolSelector 

Fields

Tool requirements check

data ToolCheckResult Source #

Since: 0.0.0.0

Constructors

ToolCheckError ToolCheckError

Since: 0.1.0.0

ToolOk

Since: 0.0.0.0

Instances

Instances details
Show ToolCheckResult Source #

Since: 0.0.0.0

Instance details

Defined in Iris.Tool

Eq ToolCheckResult Source #

Since: 0.0.0.0

Instance details

Defined in Iris.Tool

data ToolCheckError Source #

Since: 0.1.0.0

Constructors

ToolNotFound Text

Since: 0.1.0.0

ToolWrongVersion Text

Since: 0.1.0.0

Instances

Instances details
Show ToolCheckError Source #

Since: 0.1.0.0

Instance details

Defined in Iris.Tool

Eq ToolCheckError Source #

Since: 0.1.0.0

Instance details

Defined in Iris.Tool

newtype ToolCheckException Source #

An exception thrown by need when there's an error requiring a tool.

Since: 0.1.0.0

checkTool :: Tool -> IO ToolCheckResult Source #

Since: 0.0.0.0