Commit 49df26ea3b89adefef01fd20586cb8dd699e8691

Authored by Göran Krampe
1 parent 33f6041b

Updated for new Nim

blimp.nim
... ... @@ -14,7 +14,7 @@ import md5, os, osproc, parseopt2, strutils, parsecfg, streams, lapp, subexes, t
14 14  
15 15 const
16 16 versionMajor* = 0
17   - versionMinor* = 4
  17 + versionMinor* = 5
18 18 versionPatch* = 0
19 19 versionAsString* = $versionMajor & "." & $versionMinor & "." & $versionPatch
20 20  
... ... @@ -307,14 +307,14 @@ proc deflate(filename: string) =
307 307 if verbose: echo("\t" & filename & " deflated.")
308 308  
309 309 # Iterator over all deflated files in the git clone
310   -iterator allDeflated() =
  310 +iterator allDeflated(): string =
311 311 let filenames = cmd("git ls-files " & gitRootDir).split({'\l', '\c'})
312 312 for fn in filenames:
313 313 if not blimpFilename(fn).isNil:
314 314 yield fn
315 315  
316 316 # Iterator over all files matching the blimp filter in the git clone
317   -iterator allFiltered() =
  317 +iterator allFiltered(): string =
318 318 let lines = cmd("git ls-files | git check-attr --stdin filter").split({'\l', '\c'})
319 319 for line in lines:
320 320 let status = line.split(':')
... ...
blimp.nimble
1 1 [Package]
2 2 name = "blimp"
3   -version = "0.4"
  3 +version = "0.5"
4 4 author = "Göran Krampe"
5 5 description = "Utility that helps with big files in git, very similar to git-fat, s3annnex etc."
6 6 license = "MIT"
... ... @@ -8,5 +8,5 @@ license = "MIT"
8 8 bin = blimp
9 9  
10 10 [Deps]
11   -Requires: "nimrod >= 0.10"
12   -Requires: "lapp >= 0.1.0"
  11 +Requires: "nimrod >= 0.15"
  12 +#Requires: "lapp >= 0.1.0"
... ...
lapp.nim
... ... @@ -134,7 +134,7 @@ var
134 134 parm_spec = initTable[string,PSpec]()
135 135  
136 136 proc fail(msg: string) =
137   - stderr.writeln(progname & ": " & msg)
  137 + stderr.writeLine(progname & ": " & msg)
138 138 quit(usage)
139 139  
140 140 proc parseSpec(u: string) =
... ... @@ -254,7 +254,7 @@ proc parseArguments*(usage: string, args: seq[string]): Table[string,PValue] =
254 254 fail("no such option: " & c)
255 255  
256 256 proc get_spec(name: string): PSpec =
257   - result = parm_spec[name]
  257 + result = parm_spec.getOrDefault(name)
258 258 if result == nil:
259 259 fail("no such option: " & name)
260 260  
... ... @@ -374,7 +374,7 @@ proc parseArguments*(usage: string, args: seq[string]): Table[string,PValue] =
374 374 pval = fileValue(f,value)
375 375 else: discard
376 376  
377   - var oval = vars[flag]
  377 + var oval = vars.getOrDefault(flag)
378 378 if info.multiple: # multiple flags are sequence values
379 379 if oval == nil: # first value!
380 380 pval = seqValue(@[pval])
... ... @@ -440,11 +440,11 @@ when isMainModule:
440 440 let v = verbosityLevel(args)
441 441  
442 442 echo "Lines to show: " & $n
443   - echo "Verbosity level: " & $verbosityLevel(args)
  443 + echo "Verbosity level: " & $v
444 444  
445 445 let myfiles = args["files"].asSeq
446 446 var outFile = args["out"].asFile
447 447  
448 448 for f in myfiles:
449 449 for i in 1..n:
450   - writeln(outFile, string(f.asFile.readLine()))
  450 + writeLine(outFile, string(f.asFile.readLine()))
... ...