2 Commits

Author SHA1 Message Date
15708cebdf Add explicit dependency on isaac >= 0.1.2
Something depends on isaac 0.1.0, but that version doesn't compile on Nim 0.16
and above. Until the transitive dependancy is updated, ask for at least 0.1.2.
2017-02-21 11:18:12 -06:00
78a35b6478 Added list tags command. 2017-02-09 10:57:51 -06:00
4 changed files with 23 additions and 11 deletions

8
private/ptkutil.nim Normal file
View File

@ -0,0 +1,8 @@
template first*(a: openarray): auto = a[0]
template last*(a: openarray): auto = a[len(a)-1]
proc flatten*[T](a: seq[seq[T]]): seq[T] =
result = @[]
for subseq in a:
result.add(subseq)

19
ptk.nim
View File

@ -6,7 +6,7 @@
import algorithm, docopt, json, langutils, logging, os, nre, sequtils,
sets, strutils, tempfile, terminal, times, timeutils, uuids
import ptkutil
import private/ptkutil
type
Mark* = tuple[id: UUID, time: TimeInfo, summary: string, notes: string, tags: seq[string]]
@ -347,6 +347,7 @@ Usage:
ptk continue
ptk delete <id>
ptk (list | ls) [options]
ptk (list | ls) tags
ptk sum-time --ids <ids>...
ptk sum-time [options] [<firstId>] [<lastId>]
ptk (-V | --version)
@ -379,7 +380,7 @@ Options:
let now = getLocalTime(getTime())
# Parse arguments
let args = docopt(doc, version = "ptk 0.8.0")
let args = docopt(doc, version = "ptk 0.10.0")
if args["--echo-args"]: echo $args
@ -590,11 +591,17 @@ Options:
if args["list"] or args["ls"]:
var selectedIndices = timeline.filterMarkIndices(args)
if args["tags"]:
timeline.writeMarks(
indices = selectedIndices,
includeNotes = args["--version"])
echo $(timeline.marks.mapIt(it.tags)
.flatten().deduplicate().sorted(system.cmp).join("\n"))
else:
var selectedIndices = timeline.filterMarkIndices(args)
timeline.writeMarks(
indices = selectedIndices,
includeNotes = args["--version"])
if args["sum-time"]:

View File

@ -1,6 +1,6 @@
# Package
version = "0.8.0"
version = "0.10.0"
author = "Jonathan Bernard"
description = "Personal Time Keeper"
license = "MIT"
@ -8,5 +8,5 @@ bin = @["ptk"]
# Dependencies
requires @["nim >= 0.15.0", "docopt >= 0.6.4", "uuids", "langutils", "tempfile", "timeutils >= 0.2.0"]
requires @["nim >= 0.15.0", "docopt >= 0.6.4", "uuids", "langutils", "tempfile", "timeutils >= 0.2.0", "isaac >= 0.1.2"]

View File

@ -1,3 +0,0 @@
template first*(a: openarray): auto = a[0]
template last*(a: openarray): auto = a[len(a)-1]