[uishell] ProgressUI uses only 2 line per file (#221)

This commit is contained in:
Paul Campbell 2019-09-29 20:01:46 +01:00 committed by GitHub
parent d4d6d7ffbe
commit 61231b8e97
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,7 +18,7 @@ object ProgressUI {
private val uploads: AtomicReference[Map[RemoteKey, UploadState]] = private val uploads: AtomicReference[Map[RemoteKey, UploadState]] =
new AtomicReference[Map[RemoteKey, UploadState]](Map.empty) new AtomicReference[Map[RemoteKey, UploadState]](Map.empty)
private val statusHeight = 3 private val statusHeight = 2
def requestCycle( def requestCycle(
localFile: LocalFile, localFile: LocalFile,
@ -53,12 +53,14 @@ object ProgressUI {
val fileLength = sizeInEnglish(state.fileLength) val fileLength = sizeInEnglish(state.fileLength)
val line1 = val line1 =
s"${GREEN}Uploading:$RESET ${remoteKey.key}$eraseLineForward" s"${GREEN}Uploading:$RESET ${remoteKey.key}$eraseLineForward"
val line2 = s"$GREEN File:$RESET ($percent%) $transferred of $fileLength" + s"$eraseLineForward" val line2body = s"($percent%) $transferred of $fileLength "
val line3 = val bar =
progressBar(state.transferred, state.fileLength, Terminal.width) progressBar(state.transferred,
state.fileLength,
Terminal.width - line2body.length)
val line2 = s"$GREEN$line2body$RESET$bar$eraseLineForward"
Console.putStrLn(line1) *> Console.putStrLn(line1) *>
Console.putStrLn(line2) *> Console.putStrLn(line2)
Console.putStrLn(line3)
} }
} *> Console.putStr(resetCursor) } *> Console.putStr(resetCursor)
} }