module HMGit.Commands.Plumbing.LsFiles.Cmd ( lsFilesCmd ) where import HMGit.Commands (Cmd (..)) import HMGit.Commands.Plumbing.LsFiles.Core (LsFiles, LsFilesCfg (..), lsFilesDetail, lsFilesShow) import Control.Exception.Safe (MonadCatch) import Control.Monad.IO.Class (MonadIO) import Data.Foldable (asum) import qualified Options.Applicative as OA lsFilesMode :: (MonadCatch m, MonadIO m, OA.Alternative m) => OA.Parser (LsFiles m) lsFilesMode :: Parser (LsFiles m) lsFilesMode = [Parser (LsFiles m)] -> Parser (LsFiles m) forall (t :: * -> *) (f :: * -> *) a. (Foldable t, Alternative f) => t (f a) -> f a asum [ LsFiles m -> Mod FlagFields (LsFiles m) -> Parser (LsFiles m) forall a. a -> Mod FlagFields a -> Parser a OA.flag' LsFiles m forall (m :: * -> *). (MonadCatch m, MonadIO m, Alternative m) => LsFiles m lsFilesDetail (Mod FlagFields (LsFiles m) -> Parser (LsFiles m)) -> Mod FlagFields (LsFiles m) -> Parser (LsFiles m) forall a b. (a -> b) -> a -> b $ [Mod FlagFields (LsFiles m)] -> Mod FlagFields (LsFiles m) forall a. Monoid a => [a] -> a mconcat [ Char -> Mod FlagFields (LsFiles m) forall (f :: * -> *) a. HasName f => Char -> Mod f a OA.short Char 's' , String -> Mod FlagFields (LsFiles m) forall (f :: * -> *) a. HasName f => String -> Mod f a OA.long String "stage" , String -> Mod FlagFields (LsFiles m) forall (f :: * -> *) a. String -> Mod f a OA.help String "Show staged contents' mode bits, object name and stage number in the output." ] , LsFiles m -> Parser (LsFiles m) forall (f :: * -> *) a. Applicative f => a -> f a pure LsFiles m forall (m :: * -> *). (MonadCatch m, MonadIO m, Alternative m) => LsFiles m lsFilesShow ] fileNames :: OA.Parser [FilePath] fileNames :: Parser [String] fileNames = Parser String -> Parser [String] forall (f :: * -> *) a. Alternative f => f a -> f [a] OA.many (Parser String -> Parser [String]) -> Parser String -> Parser [String] forall a b. (a -> b) -> a -> b $ ReadM String -> Mod ArgumentFields String -> Parser String forall a. ReadM a -> Mod ArgumentFields a -> Parser a OA.argument ReadM String forall s. IsString s => ReadM s OA.str (Mod ArgumentFields String -> Parser String) -> Mod ArgumentFields String -> Parser String forall a b. (a -> b) -> a -> b $ [Mod ArgumentFields String] -> Mod ArgumentFields String forall a. Monoid a => [a] -> a mconcat [ String -> Mod ArgumentFields String forall (f :: * -> *) a. HasMetavar f => String -> Mod f a OA.metavar String "<files>..." , String -> Mod ArgumentFields String forall (f :: * -> *) a. String -> Mod f a OA.help String "Files to show. If no files are given all files which match the other specified criteria are shown." ] lsFilesCmd :: (MonadCatch m, MonadIO m, OA.Alternative m) => OA.Mod OA.CommandFields (Cmd m) lsFilesCmd :: Mod CommandFields (Cmd m) lsFilesCmd = String -> ParserInfo (Cmd m) -> Mod CommandFields (Cmd m) forall a. String -> ParserInfo a -> Mod CommandFields a OA.command String "ls-files" (ParserInfo (Cmd m) -> Mod CommandFields (Cmd m)) -> ParserInfo (Cmd m) -> Mod CommandFields (Cmd m) forall a b. (a -> b) -> a -> b $ Parser (Cmd m) -> InfoMod (Cmd m) -> ParserInfo (Cmd m) forall a. Parser a -> InfoMod a -> ParserInfo a OA.info (LsFiles m -> LsFilesCfg -> Cmd m forall (m :: * -> *). LsFiles m -> LsFilesCfg -> Cmd m CmdLsFiles (LsFiles m -> LsFilesCfg -> Cmd m) -> Parser (LsFiles m) -> Parser (LsFilesCfg -> Cmd m) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> (Parser (LsFiles m -> LsFiles m) forall a. Parser (a -> a) OA.helper Parser (LsFiles m -> LsFiles m) -> Parser (LsFiles m) -> Parser (LsFiles m) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Parser (LsFiles m) forall (m :: * -> *). (MonadCatch m, MonadIO m, Alternative m) => Parser (LsFiles m) lsFilesMode) Parser (LsFilesCfg -> Cmd m) -> Parser LsFilesCfg -> Parser (Cmd m) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> ([String] -> LsFilesCfg LsFilesCfg ([String] -> LsFilesCfg) -> Parser [String] -> Parser LsFilesCfg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Parser [String] fileNames)) (InfoMod (Cmd m) -> ParserInfo (Cmd m)) -> InfoMod (Cmd m) -> ParserInfo (Cmd m) forall a b. (a -> b) -> a -> b $ String -> InfoMod (Cmd m) forall a. String -> InfoMod a OA.progDesc String "Show information about files in the index and the working tree"