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 -> FilePath -> Annex Bool
downloadUrl key file = do downloadUrl key file = do
showNote "downloading" showNote "downloading"
liftIO $ putStrLn "" -- make way for curl progress bar showProgress -- make way for curl progress bar
liftIO $ boolSystem "curl" ["-#", "-o", file, url] liftIO $ boolSystem "curl" ["-#", "-o", file, url]
where where
url = join ":" $ drop 1 $ split ":" $ show key url = join ":" $ drop 1 $ split ":" $ show key

View file

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

View file

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