aboutsummaryrefslogtreecommitdiff
path: root/src/format.nim
diff options
context:
space:
mode:
authorBenjamin Shirley-Quirk2020-08-04 20:36:19 +0000
committerBenjamin Shirley-Quirk2020-08-04 20:36:19 +0000
commit0afaa2a8cd7e56f4eabcf6b54e83bcab6be39f42 (patch)
treef474af5f8864f191eb006f3cf69e9c65490fb2cb /src/format.nim
parent8c75dc9df518579cab48a6ded803bf8d493a3cab (diff)
compiles now on current devel (1.3.5)
Diffstat (limited to 'src/format.nim')
-rw-r--r--src/format.nim16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/format.nim b/src/format.nim
index 2ac39dc..3ed7b58 100644
--- a/src/format.nim
+++ b/src/format.nim
@@ -108,7 +108,13 @@ proc printPackageInfo*(minPadding: int, color: bool, lines: varargs[PackageLineF
if values.len == 0:
@[]
elif forceBreak:
- lc[x | (y <- values.map(s => strutils.strip(s).splitLines(lineSize)), x <- y), string]
+ when NimVersion > "1.2":
+ collect(newSeq):
+ for y in values.map(s => strutils.strip(s).splitLines(lineSize)):
+ for x in y:
+ x
+ else:
+ lc[x | (y <- values.map(s => strutils.strip(s).splitLines(lineSize)), x <- y), string]
else:
values.map(v => strutils.strip(v)).foldl(a & " " & b).splitLines(lineSize)
@@ -299,7 +305,7 @@ proc printProgressFull*(bar: bool, title: string): ((string, float) -> void, ()
if not bar or width <= 0:
echo(title, "...")
- (proc (a: string, c: float) {.closure.} = discard, proc {.closure.} = discard)
+ (proc (a: string, c: float) {.sideEffect,closure.} = discard, proc {.sideEffect,closure.} = discard)
else:
let infoLen = max(width * 6 / 10, 50).int
let progressLen = width - infoLen
@@ -309,7 +315,7 @@ proc printProgressFull*(bar: bool, title: string): ((string, float) -> void, ()
var lastProgress = 0f
var averageSpeed = -1f
- proc update(prefix: string, progress: float) {.closure.} =
+ proc update(prefix: string, progress: float) {.sideEffect,closure.} =
let progressTrim = max(min(1, progress + 0.005), 0)
let progressStr = $(progressTrim * 100).int & "%"
let paddedProgressStr = ' '.repeat(5 - progressStr.len) & progressStr
@@ -347,7 +353,7 @@ proc printProgressFull*(bar: bool, title: string): ((string, float) -> void, ()
' ', timeLeft, indicator, paddedProgressStr, "\x1b[0K\r")
stdout.flushFile()
- proc terminate() {.closure.} =
+ proc terminate() {.sideEffect,closure.} =
echo()
update(" ", 0)
@@ -357,7 +363,7 @@ proc printProgressFull*(bar: bool, title: string): ((string, float) -> void, ()
proc printProgressShare*(bar: bool, title: string): ((int, int) -> void, () -> void) =
let (updateFull, terminate) = printProgressFull(bar, title)
- proc update(current: int, total: int) {.closure.} =
+ proc update(current: int, total: int) {.sideEffect,closure.} =
let prefix = if total > 0:
"(" & ' '.repeat(($total).len - ($current).len) & $current & "/" &
$total & ") "