module Stackctl.DirectoryOption ( DirectoryOption (..) , defaultDirectoryOption , HasDirectoryOption (..) , envDirectoryOption , directoryOption ) where import Stackctl.Prelude import Data.Semigroup (Last (..)) import qualified Env import Options.Applicative newtype DirectoryOption = DirectoryOption { DirectoryOption -> String unDirectoryOption :: FilePath } deriving newtype (String -> DirectoryOption forall a. (String -> a) -> IsString a fromString :: String -> DirectoryOption $cfromString :: String -> DirectoryOption IsString) deriving (NonEmpty DirectoryOption -> DirectoryOption DirectoryOption -> DirectoryOption -> DirectoryOption forall b. Integral b => b -> DirectoryOption -> DirectoryOption forall a. (a -> a -> a) -> (NonEmpty a -> a) -> (forall b. Integral b => b -> a -> a) -> Semigroup a stimes :: forall b. Integral b => b -> DirectoryOption -> DirectoryOption $cstimes :: forall b. Integral b => b -> DirectoryOption -> DirectoryOption sconcat :: NonEmpty DirectoryOption -> DirectoryOption $csconcat :: NonEmpty DirectoryOption -> DirectoryOption <> :: DirectoryOption -> DirectoryOption -> DirectoryOption $c<> :: DirectoryOption -> DirectoryOption -> DirectoryOption Semigroup) via Last DirectoryOption defaultDirectoryOption :: DirectoryOption defaultDirectoryOption :: DirectoryOption defaultDirectoryOption = DirectoryOption "." class HasDirectoryOption env where directoryOptionL :: Lens' env DirectoryOption instance HasDirectoryOption DirectoryOption where directoryOptionL :: Lens' DirectoryOption DirectoryOption directoryOptionL = forall a. a -> a id envDirectoryOption :: Env.Parser Env.Error DirectoryOption envDirectoryOption :: Parser Error DirectoryOption envDirectoryOption = forall e a. AsUnset e => Reader e a -> String -> Mod Var a -> Parser e a Env.var (forall s e. IsString s => Reader e s Env.str forall (m :: * -> *) b c a. Monad m => (b -> m c) -> (a -> m b) -> a -> m c <=< forall e s. (AsEmpty e, IsString s) => Reader e s Env.nonempty) String "DIRECTORY" forall a b. (a -> b) -> a -> b $ forall (t :: * -> *) a. HasHelp t => String -> Mod t a Env.help String "Operate on specifications in this directory" directoryOption :: Parser DirectoryOption directoryOption :: Parser DirectoryOption directoryOption = forall a. ReadM a -> Mod OptionFields a -> Parser a option forall s. IsString s => ReadM s str forall a b. (a -> b) -> a -> b $ forall a. Monoid a => [a] -> a mconcat [ forall (f :: * -> *) a. HasName f => Char -> Mod f a short Char 'd' , forall (f :: * -> *) a. HasName f => String -> Mod f a long String "directory" , forall (f :: * -> *) a. HasMetavar f => String -> Mod f a metavar String "PATH" , forall (f :: * -> *) a. String -> Mod f a help String "Operate on specifications in PATH" , forall (f :: * -> *) a. HasCompleter f => String -> Mod f a action String "directory" ]