|
|
|
@ -4,7 +4,7 @@
|
|
|
|
|
## Simple time keeping CLI
|
|
|
|
|
|
|
|
|
|
import algorithm, docopt, json, langutils, logging, os, nre, std/wordwrap,
|
|
|
|
|
sequtils, sets, strutils, tempfile, terminal, times, uuids
|
|
|
|
|
sequtils, sets, strutils, sugar, tempfile, terminal, times, uuids
|
|
|
|
|
|
|
|
|
|
import timeutils except `-`
|
|
|
|
|
|
|
|
|
@ -43,8 +43,7 @@ proc writeMarks(timeline: Timeline, indices: seq[int], includeNotes = false): vo
|
|
|
|
|
writeLine(stdout, "No marks match the given criteria.")
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
var idxs = indices.sorted(
|
|
|
|
|
proc(a, b: int): int = cmp(marks[a].time, marks[b].time))
|
|
|
|
|
var idxs = indices.sorted((a, b) => cmp(marks[a].time, marks[b].time))
|
|
|
|
|
|
|
|
|
|
let largestInterval = now - marks[idxs.first].time
|
|
|
|
|
let timeFormat =
|
|
|
|
@ -279,8 +278,9 @@ Options:
|
|
|
|
|
-e --edit Open the mark in an editor.
|
|
|
|
|
-f --file <file> Use the given timeline file.
|
|
|
|
|
-g --tags <tags> Add the given tags (comma-separated) to the selected marks.
|
|
|
|
|
-G --remove-tags <tagx> Remove the given tag from the selected marks.
|
|
|
|
|
-G --remove-tags <tags> Remove the given tag from the selected marks.
|
|
|
|
|
-h --help Print this usage information.
|
|
|
|
|
|
|
|
|
|
-m --matching <pattern> Restric the selection to marks matching <pattern>.
|
|
|
|
|
-n --notes <notes> For add and amend, set the notes for a time mark.
|
|
|
|
|
-t --time <time> For add and amend, use this time instead of the current time.
|
|
|
|
@ -491,8 +491,7 @@ Options:
|
|
|
|
|
mark.tags = mark.tags.deduplicate
|
|
|
|
|
if args["--remove-tags"]:
|
|
|
|
|
let tagsToRemove = (args["--remove-tags"] ?: "").split({',', ';'})
|
|
|
|
|
mark.tags = mark.tags.filter(proc (t: string): bool =
|
|
|
|
|
anyIt(tagsToRemove, it == t))
|
|
|
|
|
mark.tags = mark.tags.filter((t) => not anyIt(tagsToRemove, it == t))
|
|
|
|
|
if args["--time"]:
|
|
|
|
|
try: mark.time = parseTime($args["--time"])
|
|
|
|
|
except: raise newException(ValueError,
|
|
|
|
|