aboutsummaryrefslogtreecommitdiff
path: root/src/feature/syncinfo.nim
diff options
context:
space:
mode:
authorkitsunyan2018-09-14 19:38:20 +0000
committerkitsunyan2018-09-14 19:38:20 +0000
commitc0dd5e7dedf996c78617e21a7ea6bd2e3553dbfb (patch)
tree79de1a4b1b85056142e01e1650ce6823e3cf0807 /src/feature/syncinfo.nim
parent7109cbd68e541af13dcb258d8156ddf4c46735e7 (diff)
Display out-of-date flag date in package info
Diffstat (limited to 'src/feature/syncinfo.nim')
-rw-r--r--src/feature/syncinfo.nim22
1 files changed, 10 insertions, 12 deletions
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