2 Commits
1.0.4 ... 1.0.6

3 changed files with 9 additions and 8 deletions

View File

@ -1 +1 @@
const PTK_VERSION* = "1.0.4"
const PTK_VERSION* = "1.0.6"

13
ptk.nim
View File

@ -3,8 +3,8 @@
##
## Simple time keeping CLI
import algorithm, docopt, json, langutils, logging, os, nre, sequtils,
sets, strutils, tempfile, terminal, times, uuids
import algorithm, docopt, json, langutils, logging, os, nre, std/wordwrap,
sequtils, sets, strutils, tempfile, terminal, times, uuids
import timeutils except `-`;
@ -98,7 +98,7 @@ proc writeMarks(timeline: Timeline, indices: seq[int], includeNotes = false): vo
if includeNotes and len(w.mark.notes.strip) > 0:
writeLine(stdout, "")
let wrappedNotes = wordWrap(s = w.mark.notes,
let wrappedNotes = wrapWords(s = w.mark.notes,
maxLineWidth = colWidth)
for line in splitLines(wrappedNotes):
writeLine(stdout, spaces(notesPrefixLen) & line)
@ -152,17 +152,18 @@ proc edit(mark: Mark): Mark =
discard os.execShellCmd "$EDITOR " & tempFileName & " </dev/tty >/dev/tty"
var markPart = Time
var notes: seq[string] = @[]
for line in lines tempFileName:
if strip(line)[0] == '#': continue
if strip(line).len > 0 and strip(line)[0] == '#': continue
elif markPart == Time: result.time = parseTime(line); markPart = Summary
elif markPart == Summary: result.summary = line; markPart = Tags
elif markPart == Tags:
result.tags = line.split({',', ';'});
result.notes = ""
markPart = Notes
else: result.notes &= line & "\x0D\x0A"
else: notes.add(line)
result.notes = notes.join("\n")
finally: close(tempFile)
proc filterMarkIndices(timeline: Timeline, args: Table[string, Value]): seq[int] =

View File

@ -1,6 +1,6 @@
# Package
version = "1.0.4"
version = "1.0.6"
author = "Jonathan Bernard"
description = "Personal Time Keeper"
license = "MIT"