-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A CLI library for stackage commands -- @package stackage-cli @version 0.1.0.1 -- | Functions for creating and calling Stackage plugins. module Stackage.CLI -- | Runs a stackage plugin. Handy for dynamic one-off runs, but if you'll -- be running multiple plugins, it is recommended that you use -- findPlugins "stackage" so that the plugin search is performed -- only once. runStackagePlugin :: Text -> [String] -> IO () -- | Represents the plugins available to a given program. See: -- findPlugins. data Plugins -- | Find the plugins for a given program by inspecting everything on the -- PATH. Any program that is prefixed with the given name and responds to -- the `--summary` flag by writing one line to stdout is considered a -- plugin. findPlugins :: Text -> IO Plugins -- | A convenience wrapper around lookupPlugin and pluginProc. Handles -- stdin, stdout, and stderr are all inherited by the plugin. Throws -- PluginException. callPlugin :: (MonadIO m, MonadThrow m) => Plugins -> Text -> [String] -> m () -- | Things that can go wrong when using callPlugin. data PluginException PluginNotFound :: !Plugins -> !Text -> PluginException PluginExitFailure :: !Plugin -> !Int -> PluginException -- | Generate the "commands" argument to simpleOptions based on available -- plugins. commandsFromPlugins :: Plugins -> EitherT Text (Writer (Mod CommandFields Text)) () -- | This is a drop-in replacement for simpleOptions from -- Options.Applicative.Simple, with the added feature of a `--summary` -- flag that prints out the header. (Should be one line) simpleOptions :: String -> String -> String -> Parser a -> EitherT b (Writer (Mod CommandFields b)) () -> IO (a, b) -- | Add a command to the options dispatcher. addCommand :: String -> String -> (a -> b) -> Parser a -> EitherT b (Writer (Mod CommandFields b)) () -- | Generate a string like Version 1.2, Git revision 1234. -- -- $(simpleVersion …) :: String simpleVersion :: Version -> Q Exp -- | List the available plugins. listPlugins :: Plugins -> [Plugin] -- | Look up a particular plugin by name. lookupPlugin :: Plugins -> Text -> Maybe Plugin -- | Represents a runnable plugin. Plugins must be discovered via -- findPlugins. data Plugin -- | The program being plugged into. pluginPrefix :: Plugin -> Text -- | The name of this plugin (without the prefix). pluginName :: Plugin -> Text -- | A summary of what this plugin does pluginSummary :: Plugin -> Text -- | Describes how to create a process out of a plugin and arguments. You -- may use Data.Process and Data.Conduit.Process to manage the process's -- stdin, stdout, and stderr in various ways. pluginProc :: Plugin -> [String] -> CreateProcess