avoid unnessary newlines before progress in quiet mode

This commit is contained in:
Joey Hess 2010-10-29 14:10:55 -04:00
parent d92f186fc4
commit 7c0777c60d
3 changed files with 6 additions and 3 deletions

View file

@ -41,7 +41,7 @@ dummyOk url = return True
downloadUrl :: Key -> FilePath -> Annex Bool
downloadUrl key file = do
showNote "downloading"
liftIO $ putStrLn "" -- make way for curl progress bar
showProgress -- make way for curl progress bar
liftIO $ boolSystem "curl" ["-#", "-o", file, url]
where
url = join ":" $ drop 1 $ split ":" $ show key

View file

@ -154,6 +154,8 @@ showNote :: String -> Annex ()
showNote s = verbose $ do
liftIO $ putStr $ "(" ++ s ++ ") "
liftIO $ hFlush stdout
showProgress :: Annex ()
showProgress = verbose $ liftIO $ putStr $ "\n"
showLongNote :: String -> Annex ()
showLongNote s = verbose $ do
liftIO $ putStr $ "\n" ++ (indent s)

View file

@ -39,6 +39,7 @@ import LocationLog
import Locations
import UUID
import Utility
import qualified Core
{- Human visible list of remotes. -}
list :: [Git.Repo] -> String
@ -200,7 +201,7 @@ copyFromRemote r key file = do
where
getlocal = liftIO $ boolSystem "cp" ["-a", keyloc, file]
getssh = do
liftIO $ putStrLn "" -- make way for scp progress bar
Core.showProgress -- make way for scp progress bar
liftIO $ boolSystem "scp" [sshLocation r keyloc, file]
keyloc = annexLocation r key
@ -217,7 +218,7 @@ copyToRemote r key file = do
where
putlocal src = liftIO $ boolSystem "cp" ["-a", src, file]
putssh src = do
liftIO $ putStrLn "" -- make way for scp progress bar
Core.showProgress -- make way for scp progress bar
liftIO $ boolSystem "scp" [src, sshLocation r file]
sshLocation :: Git.Repo -> FilePath -> FilePath