cabal-install-3.8.1.0: The command-line interface for Cabal and Hackage.
Safe HaskellNone
LanguageHaskell2010

Distribution.Client.CmdRun

Description

cabal-install CLI command: run

Synopsis

The run CLI and action

runAction :: NixStyleFlags () -> [String] -> GlobalFlags -> IO () Source #

The run command runs a specified executable-like component, building it first if necessary. The component can be either an executable, a test, or a benchmark. This is particularly useful for passing arguments to exestestsbenchs by simply appending them after a --.

For more details on how this works, see the module Distribution.Client.ProjectOrchestration

handleShebang :: FilePath -> [String] -> IO () Source #

Handle cabal invoked as script interpreter, see also validScript

First argument is the FilePath to the script to be executed; second argument is a list of arguments to be passed to the script.

validScript :: String -> IO Bool Source #

Used by the main CLI parser as heuristic to decide whether cabal was invoked as a script interpreter, i.e. via

#! /usr/bin/env cabal

or

#! /usr/bin/cabal

As the first argument passed to cabal will be a filepath to the script to be interpreted.

See also handleShebang

Internals exposed for testing

noExesProblem :: TargetSelector -> RunTargetProblem Source #

selectPackageTargets :: TargetSelector -> [AvailableTarget k] -> Either RunTargetProblem [k] Source #

This defines what a TargetSelector means for the run command. It selects the AvailableTargets that the TargetSelector refers to, or otherwise classifies the problem.

For the run command we select the exe if there is only one and it's buildable. Fail if there are no or multiple buildable exe components.

selectComponentTarget :: SubComponentTarget -> AvailableTarget k -> Either RunTargetProblem k Source #

For a TargetComponent TargetSelector, check if the component can be selected.

For the run command we just need to check it is a executable-like (an executable, a test, or a benchmark), in addition to the basic checks on being buildable etc.