Add the ability to hide tasks until a certain date.
This commit is contained in:
parent
9606e71cec
commit
d93c0cf348
@ -1,6 +1,6 @@
|
|||||||
# Package
|
# Package
|
||||||
|
|
||||||
version = "4.12.0"
|
version = "4.13.0"
|
||||||
author = "Jonathan Bernard"
|
author = "Jonathan Bernard"
|
||||||
description = "Personal issue tracker."
|
description = "Personal issue tracker."
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
26
src/pit.nim
26
src/pit.nim
@ -233,7 +233,11 @@ proc list(ctx: CliContext, filter: Option[IssueFilter], state: Option[IssueState
|
|||||||
|
|
||||||
for s in [Pending, Todo]:
|
for s in [Pending, Todo]:
|
||||||
if ctx.issues.hasKey(s) and ctx.issues[s].len > 0:
|
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(
|
||||||
|
not (it.hasProp("hide-until") and
|
||||||
|
it.getDateTime("hide-until") > getTime().local))
|
||||||
|
|
||||||
|
stdout.write ctx.formatSection(visibleIssues, s, indent, verbose)
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
|
|
||||||
@ -241,17 +245,18 @@ when isMainModule:
|
|||||||
let doc = """
|
let doc = """
|
||||||
Usage:
|
Usage:
|
||||||
pit ( new | add) <summary> [<state>] [options]
|
pit ( new | add) <summary> [<state>] [options]
|
||||||
pit list contexts
|
pit list contexts [options]
|
||||||
pit list [<stateOrId>] [options]
|
pit list [<stateOrId>] [options]
|
||||||
pit ( start | done | pending | todo-today | todo | suspend ) <id>... [options]
|
pit ( start | done | pending | todo-today | todo | suspend ) <id>... [options]
|
||||||
pit edit <ref>...
|
pit edit <ref>... [options]
|
||||||
pit tag <id>... [options]
|
pit tag <id>... [options]
|
||||||
pit untag <id>... [options]
|
pit untag <id>... [options]
|
||||||
pit reorder <state>
|
pit reorder <state> [options]
|
||||||
pit delegate <id> <delegated-to>
|
pit delegate <id> <delegated-to>
|
||||||
pit ( delete | rm ) <id>...
|
pit hide-until <id> <date> [options]
|
||||||
pit add-binary-property <id> <propName> <propSource>
|
pit ( delete | rm ) <id>... [options]
|
||||||
pit get-binary-property <id> <propName> <propDest>
|
pit add-binary-property <id> <propName> <propSource> [options]
|
||||||
|
pit get-binary-property <id> <propName> <propDest> [options]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
|
||||||
@ -423,6 +428,13 @@ Options:
|
|||||||
elif targetState == Done or targetState == Pending:
|
elif targetState == Done or targetState == Pending:
|
||||||
discard execShellCmd("ptk stop")
|
discard execShellCmd("ptk stop")
|
||||||
|
|
||||||
|
elif args["hide-until"]:
|
||||||
|
|
||||||
|
let issue = ctx.tasksDir.loadIssueById($(args["<id>"]))
|
||||||
|
issue.setDateTime("hide-until", parseDate($args["<date>"]))
|
||||||
|
|
||||||
|
issue.store()
|
||||||
|
|
||||||
elif args["delegate"]:
|
elif args["delegate"]:
|
||||||
|
|
||||||
let issue = ctx.tasksDir.loadIssueById($(args["<id>"]))
|
let issue = ctx.tasksDir.loadIssueById($(args["<id>"]))
|
||||||
|
@ -105,6 +105,23 @@ proc groupBy*(issues: seq[Issue], propertyKey: string): TableRef[string, seq[Iss
|
|||||||
result[key].add(i)
|
result[key].add(i)
|
||||||
|
|
||||||
|
|
||||||
|
## Parse and format dates
|
||||||
|
const DATE_FORMATS = [
|
||||||
|
"MM/dd",
|
||||||
|
"MM-dd",
|
||||||
|
"yyyy-MM-dd",
|
||||||
|
"yyyy/MM/dd",
|
||||||
|
"yyyy-MM-dd'T'hh:mm:ss"
|
||||||
|
]
|
||||||
|
proc parseDate*(d: string): DateTime =
|
||||||
|
var errMsg = ""
|
||||||
|
for df in DATE_FORMATS:
|
||||||
|
try: return d.parse(df)
|
||||||
|
except:
|
||||||
|
errMsg &= "\n\tTried " & df & " with " & d
|
||||||
|
continue
|
||||||
|
raise newException(ValueError, "Unable to parse input as a date: " & d & errMsg)
|
||||||
|
|
||||||
## Parse and format issues
|
## Parse and format issues
|
||||||
proc fromStorageFormat*(id: string, issueTxt: string): Issue =
|
proc fromStorageFormat*(id: string, issueTxt: string): Issue =
|
||||||
type ParseState = enum ReadingSummary, ReadingProps, ReadingDetails
|
type ParseState = enum ReadingSummary, ReadingProps, ReadingDetails
|
||||||
|
@ -1 +1 @@
|
|||||||
const PIT_VERSION* = "4.12.0"
|
const PIT_VERSION* = "4.13.0"
|
Loading…
x
Reference in New Issue
Block a user