packages feed

autonix-deps-0.1.0.0: src/Autonix/Args.hs

module Autonix.Args where

import Control.Applicative
import Control.Monad (join)
import Control.Monad.IO.Class
import Options.Applicative

withArgs :: MonadIO m => (FilePath -> Maybe FilePath -> m a) -> m a
withArgs child =
    join $ liftIO $ execParser $ info (helper <*> parser) fullDesc
  where
    parser = child
             <$> strArgument (metavar "MANIFEST")
             <*> option
                (Just <$> str)
                (long "renames" <> metavar "FILENAME" <> value Nothing)