From 57565e4235859d02f07e9936e02b7fce37e24309 Mon Sep 17 00:00:00 2001 From: "Yann Esposito (Yogsototh)" Date: Tue, 16 Oct 2018 21:28:23 +0200 Subject: [PATCH] added command to show dir --- src/GPM/Serve.hs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/GPM/Serve.hs b/src/GPM/Serve.hs index ece6438..698ca8b 100644 --- a/src/GPM/Serve.hs +++ b/src/GPM/Serve.hs @@ -67,6 +67,7 @@ init = do data ServeCommand = ServeStart | ServeStop | ServeUpdate + | ProjectDir deriving (Eq) parseServeCommand :: Parser ServeCommand @@ -74,27 +75,35 @@ parseServeCommand = subcommand "start" "Start to serve all gpm tracked repositories" (pure ServeStart) <|> subcommand "stop" "Stop to serve all gpm tracked repositories" (pure ServeStop) <|> subcommand "update" "Update the served git repository" (pure ServeUpdate) + <|> subcommand "path" "Show the path of the bare repository" (pure ServeUpdate) handleServe :: ServeCommand -> Text -> IO () handleServe ServeStart _ = handleServeStart handleServe ServeStop _ = handleServeStop handleServe ServeUpdate _ = handleUpdate +handleServe ProjectDir _ = handleProjectDir handleUpdate :: IO () handleUpdate = do pubPrjDir <- getPublicPrjDir - inDir pubPrjDir $ - debug_ "git pull" + inDir pubPrjDir $ do + pwd >>= putText . format fp + debug_ "git fetch" handleServeStart :: IO () handleServeStart = do pubDir <- getPublicDir - inDir pubDir $ + inDir pubDir $ do + pwd >>= putText . format fp debug_ "git instaweb --http=webrick start" -- TODO: Do not forget to also git serve handleServeStop :: IO () handleServeStop = do pubDir <- getPublicDir - inDir pubDir $ + inDir pubDir $ do + pwd >>= putText . format fp debug_ "git instaweb --http=webrick stop" + +handleProjectDir :: IO () +handleProjectDir = getPublicDir >>= putText . format fp