Compare commits

...

2 Commits

6 changed files with 36 additions and 11 deletions

View File

@ -1,6 +1,6 @@
# Package
version = "4.16.0"
version = "4.18.0"
author = "Jonathan Bernard"
description = "Personal issue tracker."
license = "MIT"

View File

@ -200,17 +200,26 @@ proc edit(issue: Issue) =
getCurrentExceptionMsg()
issue.store()
proc list(ctx: CliContext, filter: Option[IssueFilter], states: Option[seq[IssueState]], showToday, showFuture, verbose: bool) =
proc list(
ctx: CliContext,
filter: Option[IssueFilter],
states: Option[seq[IssueState]],
showToday, showFuture,
showHidden = false,
verbose: bool) =
if states.isSome:
trace "listing issues for " & $states.get
for state in states.get:
ctx.loadIssues(state)
if filter.isSome: ctx.filterIssues(filter.get)
# Show Done for just today if requested
if state == Done and showToday:
ctx.issues[Done] = ctx.issues[Done].filterIt(
it.hasProp("completed") and
sameDay(getTime().local, it.getDateTime("completed")))
stdout.write ctx.formatSection(ctx.issues[state], state, "", verbose)
trace "listing complete"
return
@ -234,7 +243,12 @@ proc list(ctx: CliContext, filter: Option[IssueFilter], states: Option[seq[Issue
for s in [Current, TodoToday, Pending]:
if ctx.issues.hasKey(s) and ctx.issues[s].len > 0:
stdout.write ctx.formatSection(ctx.issues[s], s, indent, verbose)
let visibleIssues = ctx.issues[s].filterIt(
showHidden or
not (it.hasProp("hide-until") and
it.getDateTime("hide-until") > getTime().local))
stdout.write ctx.formatSection(visibleIssues, s, indent, verbose)
# Future items
if future:
@ -243,6 +257,7 @@ proc list(ctx: CliContext, filter: Option[IssueFilter], states: Option[seq[Issue
for s in [Pending, Todo]:
if ctx.issues.hasKey(s) and ctx.issues[s].len > 0:
let visibleIssues = ctx.issues[s].filterIt(
showHidden or
not (it.hasProp("hide-until") and
it.getDateTime("hide-until") > getTime().local))
@ -378,6 +393,9 @@ when isMainModule:
if issue.hasProp("recurrence") and issue.getRecurrence.isSome:
let nextIssue = ctx.tasksDir.nextRecurrence(issue.getRecurrence.get, issue)
ctx.tasksDir.store(nextIssue, Todo)
info "created the next recurrence:"
stdout.writeLine ctx.formatIssue(nextIssue)
issue.changeState(ctx.tasksDir, targetState)
@ -495,9 +513,13 @@ when isMainModule:
else:
trace "listing all issues"
let showBoth = args["--today"] == args["--future"]
ctx.list(filterOption, statesOption, showBoth or args["--today"],
showBoth or args["--future"],
ctx.verbose)
ctx.list(
filter = filterOption,
states = statesOption,
showToday = showBoth or args["--today"],
showFuture = showBoth or args["--future"],
showHidden = args["--show-hidden"],
verbose = ctx.verbose)
elif args["add-binary-property"]:
let issue = ctx.tasksDir.loadIssueById($(args["<id>"]))

View File

@ -40,10 +40,10 @@ template checkAuth(cfg: PitApiCfg) =
var authed {.inject.} = false
try:
if not request.headers.hasKey("Authorization"):
if not headers(request).hasKey("Authorization"):
raiseEx "No auth token."
let headerVal = request.headers["Authorization"]
let headerVal = headers(request)["Authorization"]
if not headerVal.startsWith("Bearer "):
raiseEx "Invalid Authentication type (only 'Bearer' is supported)."

View File

@ -315,8 +315,8 @@ proc nextRecurrence*(tasksDir: string, rec: Recurrence, defaultIssue: Issue): Is
let newProps = newTable[string,string]()
for k, v in baseIssue.properties:
if k != "created" and k != "completed":
newProps[k] = v
if k != "completed": newProps[k] = v
newProps["prev-recurrence"] = $baseIssue.id
result = Issue(
id: genUUID(),

View File

@ -1 +1 @@
const PIT_VERSION* = "4.16.0"
const PIT_VERSION* = "4.18.0"

View File

@ -31,6 +31,9 @@ Options:
-F, --future Limit to future issues.
-H, --show-hidden Show all matching issues, ignoring any 'hide-until'
properties set.
-m, --match <pattern> Limit to issues whose summaries match the given
pattern (PCRE regex supported).