use stderr to help scripting
This commit is contained in:
parent
57565e4235
commit
8a2783470d
4 changed files with 9 additions and 14 deletions
|
@ -44,8 +44,3 @@ parser = subcommand "init" "Initialize gpm" (pure Init)
|
||||||
<|> Serve <$> subcommand "serve"
|
<|> Serve <$> subcommand "serve"
|
||||||
"Serve the git to the web"
|
"Serve the git to the web"
|
||||||
Serve.parseServeCommand
|
Serve.parseServeCommand
|
||||||
|
|
||||||
debug :: Text -> IO ()
|
|
||||||
debug cmd = do
|
|
||||||
putText cmd
|
|
||||||
stdout $ inshell cmd empty
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ import qualified System.Console.ANSI as Console
|
||||||
-- but also log the command to the console to minimize surprise
|
-- but also log the command to the console to minimize surprise
|
||||||
debug :: Text -> IO (Maybe Text)
|
debug :: Text -> IO (Maybe Text)
|
||||||
debug cmd = do
|
debug cmd = do
|
||||||
putText cmd
|
putErrText cmd
|
||||||
fmap lineToText <$> _foldIO (inshell cmd empty) (Fold.generalize Fold.last)
|
fmap lineToText <$> _foldIO (inshell cmd empty) (Fold.generalize Fold.last)
|
||||||
|
|
||||||
-- | execute a shell script without stdin and without handling output
|
-- | execute a shell script without stdin and without handling output
|
||||||
|
|
|
@ -40,9 +40,9 @@ mkNewEmptyBranch br = sh $ do
|
||||||
clean <- fold (inshell "git status --porcelain" empty) Fold.null
|
clean <- fold (inshell "git status --porcelain" empty) Fold.null
|
||||||
if clean
|
if clean
|
||||||
then liftIO $ do
|
then liftIO $ do
|
||||||
putText $ "Create a new branch " <> br <> " (be sure the branch " <> br <> " doesn't already exists)"
|
putErrText $ "Create a new branch " <> br <> " (be sure the branch " <> br <> " doesn't already exists)"
|
||||||
debug_ $ "git checkout --orphan " <> br
|
debug_ $ "git checkout --orphan " <> br
|
||||||
echo "cleanup the branch"
|
putErrText "cleanup the branch"
|
||||||
debug_ "git rm --cached -r ."
|
debug_ "git rm --cached -r ."
|
||||||
debug_ "git clean -fd"
|
debug_ "git clean -fd"
|
||||||
else die "Please take care of pending modification and untracked files (you can use git stash --all)"
|
else die "Please take care of pending modification and untracked files (you can use git stash --all)"
|
||||||
|
|
|
@ -182,10 +182,10 @@ communicateFp :: Turtle.FilePath -> IO ()
|
||||||
communicateFp filepath = do
|
communicateFp filepath = do
|
||||||
let fptxt = format fp filepath
|
let fptxt = format fp filepath
|
||||||
mainReviewName <- getMainReviewFile
|
mainReviewName <- getMainReviewFile
|
||||||
putText $ "Main review file: " <> format fp mainReviewName
|
putErrText $ "Main review file: " <> format fp mainReviewName
|
||||||
putText $ "Review file: " <> fptxt
|
putErrText $ "Review file: " <> fptxt
|
||||||
export "GPM_REVIEW_FILE" fptxt
|
export "GPM_REVIEW_FILE" fptxt
|
||||||
putText $ "export GPM_REVIEW_FILE=" <> fptxt
|
putErrText $ "export GPM_REVIEW_FILE=" <> fptxt
|
||||||
|
|
||||||
retrieveReview :: Text -> IO ()
|
retrieveReview :: Text -> IO ()
|
||||||
retrieveReview br = do
|
retrieveReview br = do
|
||||||
|
@ -242,7 +242,7 @@ getTmpReviewFile br = do
|
||||||
|
|
||||||
createTmpNewReview :: NewReview -> Text -> IO ()
|
createTmpNewReview :: NewReview -> Text -> IO ()
|
||||||
createTmpNewReview nr br = do
|
createTmpNewReview nr br = do
|
||||||
putText "DEBUG: create temporary file for the new review"
|
putErrText "Create temporary file for the new review"
|
||||||
ecompiled <- automaticCompile ["./templates"] "new-review.org"
|
ecompiled <- automaticCompile ["./templates"] "new-review.org"
|
||||||
case ecompiled of
|
case ecompiled of
|
||||||
Left pe -> do
|
Left pe -> do
|
||||||
|
|
Loading…
Reference in a new issue