module HMGit.Commands.Porcelain.Status.Cmd ( statusCmd ) where import HMGit.Commands (Cmd (..)) import HMGit.Commands.Porcelain.Status.Core (Status, StatusCfg (..), statusDefault, statusShort) import Control.Exception.Safe (MonadCatch) import Control.Monad.IO.Class (MonadIO) import Data.Foldable (asum) import qualified Options.Applicative as OA statusMode :: (MonadCatch m, MonadIO m, OA.Alternative m) => OA.Parser (Status m) statusMode :: Parser (Status m) statusMode = [Parser (Status m)] -> Parser (Status m) forall (t :: * -> *) (f :: * -> *) a. (Foldable t, Alternative f) => t (f a) -> f a asum [ Status m -> Mod FlagFields (Status m) -> Parser (Status m) forall a. a -> Mod FlagFields a -> Parser a OA.flag' Status m forall (m :: * -> *). (MonadCatch m, MonadIO m, Alternative m) => Status m statusShort (Mod FlagFields (Status m) -> Parser (Status m)) -> Mod FlagFields (Status m) -> Parser (Status m) forall a b. (a -> b) -> a -> b $ [Mod FlagFields (Status m)] -> Mod FlagFields (Status m) forall a. Monoid a => [a] -> a mconcat [ Char -> Mod FlagFields (Status m) forall (f :: * -> *) a. HasName f => Char -> Mod f a OA.short Char 's' , String -> Mod FlagFields (Status m) forall (f :: * -> *) a. HasName f => String -> Mod f a OA.long String "short" , String -> Mod FlagFields (Status m) forall (f :: * -> *) a. String -> Mod f a OA.help String "Give the output in the short-format." ] , Status m -> Mod FlagFields (Status m) -> Parser (Status m) forall a. a -> Mod FlagFields a -> Parser a OA.flag' Status m forall (m :: * -> *). (MonadIO m, MonadCatch m, Alternative m) => Status m statusDefault (Mod FlagFields (Status m) -> Parser (Status m)) -> Mod FlagFields (Status m) -> Parser (Status m) forall a b. (a -> b) -> a -> b $ [Mod FlagFields (Status m)] -> Mod FlagFields (Status m) forall a. Monoid a => [a] -> a mconcat [ String -> Mod FlagFields (Status m) forall (f :: * -> *) a. HasName f => String -> Mod f a OA.long String "long" , String -> Mod FlagFields (Status m) forall (f :: * -> *) a. String -> Mod f a OA.help String "Give the output in the long-format. This is the default." ] , Status m -> Parser (Status m) forall (f :: * -> *) a. Applicative f => a -> f a pure Status m forall (m :: * -> *). (MonadIO m, MonadCatch m, Alternative m) => Status m statusDefault ] pathspecs :: OA.Parser [FilePath] pathspecs :: Parser [String] pathspecs = 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 "<pathspec>..." , String -> Mod ArgumentFields String forall (f :: * -> *) a. String -> Mod f a OA.help String "See the pathspec entry in gitglossary(7)." ] statusCmd :: (MonadCatch m, MonadIO m, OA.Alternative m) => OA.Mod OA.CommandFields (Cmd m) statusCmd :: Mod CommandFields (Cmd m) statusCmd = String -> ParserInfo (Cmd m) -> Mod CommandFields (Cmd m) forall a. String -> ParserInfo a -> Mod CommandFields a OA.command String "status" (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 (Status m -> StatusCfg -> Cmd m forall (m :: * -> *). Status m -> StatusCfg -> Cmd m CmdStatus (Status m -> StatusCfg -> Cmd m) -> Parser (Status m) -> Parser (StatusCfg -> Cmd m) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> (Parser (Status m -> Status m) forall a. Parser (a -> a) OA.helper Parser (Status m -> Status m) -> Parser (Status m) -> Parser (Status m) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> Parser (Status m) forall (m :: * -> *). (MonadCatch m, MonadIO m, Alternative m) => Parser (Status m) statusMode) Parser (StatusCfg -> Cmd m) -> Parser StatusCfg -> Parser (Cmd m) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b <*> ([String] -> StatusCfg StatusCfg ([String] -> StatusCfg) -> Parser [String] -> Parser StatusCfg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Parser [String] pathspecs)) (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 the working tree status"