diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/aur.nim | 3 | ||||
-rw-r--r-- | src/feature/syncinfo.nim | 22 | ||||
-rw-r--r-- | src/package.nim | 2 |
3 files changed, 14 insertions, 13 deletions
diff --git a/src/aur.nim b/src/aur.nim index d74d08a..5c138b4 100644 --- a/src/aur.nim +++ b/src/aur.nim @@ -29,13 +29,14 @@ proc parseRpcPackageInfo(obj: JsonNode, repo: string): Option[RpcPackageInfo] = let maintainer = if maintainerEmpty.len > 0: some(maintainerEmpty) else: none(string) let firstSubmitted = obj["FirstSubmitted"].getBiggestInt(0).optInt64 let lastModified = obj["LastModified"].getBiggestInt(0).optInt64 + let outOfDate = obj["OutOfDate"].getBiggestInt(0).optInt64 let votes = (int) obj["NumVotes"].getBiggestInt(0) let popularity = obj["Popularity"].getFloat(0) if base.len > 0 and name.len > 0: some(RpcPackageInfo(repo: repo, base: base, name: name, version: version, description: description, maintainer: maintainer, - firstSubmitted: firstSubmitted, lastModified: lastModified, + firstSubmitted: firstSubmitted, lastModified: lastModified, outOfDate: outOfDate, votes: votes, popularity: popularity, gitUrl: gitUrl(base), gitSubdir: none(string))) else: none(RpcPackageInfo) diff --git a/src/feature/syncinfo.nim b/src/feature/syncinfo.nim index 546c631..f06cfa5 100644 --- a/src/feature/syncinfo.nim +++ b/src/feature/syncinfo.nim @@ -48,16 +48,13 @@ proc formatDeps(title: string, config: Config, else: (title, @[], false) -proc formatDate(date: Option[int64]): seq[string] = - if date.isSome: - var time = (posix.Time) date.unsafeGet - var ltime: Tm - discard localtime_r(time, ltime) - var buffer: array[100, char] - let res = strftime(addr(buffer), buffer.len, "%c", ltime) - if res > 0: @[buffer.toString(none(int))] else: @[] - else: - @[] +proc formatDate(date: int64): Option[string] = + var time = (posix.Time) date + var ltime: Tm + discard localtime_r(time, ltime) + var buffer: array[100, char] + let res = strftime(addr(buffer), buffer.len, "%c", ltime) + if res > 0: some(buffer.toString(none(int))) else: none(string) proc handleTarget(config: Config, padding: int, args: seq[Argument], target: FullPackageTarget[PackageInfo]): int = @@ -80,8 +77,9 @@ proc handleTarget(config: Config, padding: int, args: seq[Argument], formatDeps(trp"Conflicts With", config, pkgInfo.conflicts), formatDeps(trp"Replaces", config, pkgInfo.replaces), (tr"Maintainer", toSeq(pkgInfo.maintainer.items()), false), - (tr"First Submitted", pkgInfo.firstSubmitted.formatDate, false), - (tr"Last Modified", pkgInfo.lastModified.formatDate, false), + (tr"First Submitted", toSeq(pkgInfo.firstSubmitted.map(formatDate).flatten.items()), false), + (tr"Last Modified", toSeq(pkgInfo.lastModified.map(formatDate).flatten.items()), false), + (tr"Out Of Date", toSeq(pkgInfo.outOfDate.map(formatDate).flatten.items()), false), (tr"Rating", @[formatPkgRating(pkgInfo.votes, pkgInfo.popularity)], false)) 0 diff --git a/src/package.nim b/src/package.nim index 3e2c6f7..7ad89bd 100644 --- a/src/package.nim +++ b/src/package.nim @@ -31,6 +31,7 @@ type maintainer*: Option[string] firstSubmitted*: Option[int64] lastModified*: Option[int64] + outOfDate*: Option[int64] votes*: int popularity*: float gitUrl*: string @@ -312,6 +313,7 @@ proc parseSrcInfoName(repo: string, name: string, baseIndex: int, baseCount: int maintainer: info.map(i => i.maintainer).flatten, firstSubmitted: info.map(i => i.firstSubmitted).flatten, lastModified: info.map(i => i.lastModified).flatten, + outOfDate: info.map(i => i.outOfDate).flatten, votes: info.map(i => i.votes).get(0), popularity: info.map(i => i.popularity).get(0), gitUrl: gitUrl, gitSubdir: gitSubdir) | |