diff options
author | Benjamin Shirley-Quirk | 2020-08-04 21:15:13 +0000 |
---|---|---|
committer | Benjamin Shirley-Quirk | 2020-08-04 21:15:13 +0000 |
commit | b47df19c354e6b1c3c438b57eb463bbfaa8fd08d (patch) | |
tree | 9edb0f946abab16fbeac1b047a59d8a8a262cbab /src/pacman.nim | |
parent | 0afaa2a8cd7e56f4eabcf6b54e83bcab6be39f42 (diff) |
compiles on 1.2.6
Diffstat (limited to 'src/pacman.nim')
-rw-r--r-- | src/pacman.nim | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/pacman.nim b/src/pacman.nim index d1fadb0..1b9d2f9 100644 --- a/src/pacman.nim +++ b/src/pacman.nim @@ -300,15 +300,25 @@ proc checkConflicts*(args: seq[Argument], let table = conflicts.obtainConflictsPairs template full(s: string): OptionPair = table[s][0] - when NimVersion >= "1.2": - block: - let tmp = collect(newSeq): + when NimVersion >= "1.3.5": + (block:collect(newSeq): for c in conflicts: if args.check(c.left.full): for w in c.right: if args.check(w.full): (c.left,w) - tmp.optFirst + ).optFirst + elif NimVersion >= "1.2": + (block: + var tmp = newSeq[(string,string)]() + for c in conflicts: + if args.check(c.left.full): + for w in c.right: + if args.check(w.full): + tmp.add((c.left,w)) + tmp + ).optFirst + else: lc[(c.left, w) | (c <- conflicts, args.check(c.left.full), w <- c.right, args.check(w.full)), (string, string)].optFirst @@ -340,12 +350,20 @@ proc pacmanRun*(root: bool, color: bool, args: varargs[Argument]): int = proc pacmanValidateAndThrow(args: varargs[tuple[arg: Argument, pass: bool]]): void = let argsSeq = @args - when NimVersion >= "1.2": + when NimVersion >= "1.3.5": let collectedArgs = collect(newSeq): for y in argsSeq: if y.pass: for x in y.arg.collectArg: x + elif NimVersion >= "1.2": + let collectedArgs = block: + var tmp = newSeq[string]() + for y in argsSeq: + if y.pass: + for x in y.arg.collectArg: + tmp.add(x) + tmp else: let collectedArgs = lc[x | (y <- argsSeq, y.pass, x <- y.arg.collectArg), string] let code = forkWait(() => pacmanExecInternal(false, "-T" & collectedArgs)) |