Remove tags option actually removes tags now.

This commit is contained in:
Jonathan Bernard 2020-11-12 14:44:31 -06:00
parent 136e0ade02
commit 6ab23c7c84
3 changed files with 7 additions and 8 deletions

View File

@ -1 +1 @@
const PTK_VERSION* = "1.0.8"
const PTK_VERSION* = "1.0.9"

11
ptk.nim
View File

@ -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,

View File

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