Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
0c3d73dc2b | |||
9a0bf35882 | |||
be7c099b7b | |||
d04797460c |
1
.tool-versions
Normal file
1
.tool-versions
Normal file
@ -0,0 +1 @@
|
|||||||
|
nim 1.6.20
|
@ -1,6 +1,6 @@
|
|||||||
# Package
|
# Package
|
||||||
|
|
||||||
version = "4.24.1"
|
version = "4.25.2"
|
||||||
author = "Jonathan Bernard"
|
author = "Jonathan Bernard"
|
||||||
description = "Personal issue tracker."
|
description = "Personal issue tracker."
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
44
src/pit.nim
44
src/pit.nim
@ -70,6 +70,24 @@ proc formatIssue*(issue: Issue): string =
|
|||||||
|
|
||||||
result &= termReset
|
result &= termReset
|
||||||
|
|
||||||
|
proc formatPlainIssueSummary*(issue: Issue): string =
|
||||||
|
|
||||||
|
result = "$#: $# $#" % [
|
||||||
|
$issue.state,
|
||||||
|
($issue.id)[0..<6],
|
||||||
|
issue.summary ]
|
||||||
|
|
||||||
|
if issue.hasProp("delegated-to") or issue.hasProp("pending"):
|
||||||
|
var parts = newSeq[string]()
|
||||||
|
|
||||||
|
if issue.hasProp("delegated-to"):
|
||||||
|
parts.add("delegated to " & issue["delegated-to"])
|
||||||
|
|
||||||
|
if issue.hasProp("pending"):
|
||||||
|
parts.add("pendin: " & issue["pending"])
|
||||||
|
|
||||||
|
result &= "($#)" % [ parts.join("; ") ]
|
||||||
|
|
||||||
proc formatSectionIssue*(
|
proc formatSectionIssue*(
|
||||||
issue: Issue,
|
issue: Issue,
|
||||||
width: int = 80,
|
width: int = 80,
|
||||||
@ -251,7 +269,15 @@ proc list(
|
|||||||
it.hasProp("completed") and
|
it.hasProp("completed") and
|
||||||
sameDay(getTime().local, it.getDateTime("completed")))
|
sameDay(getTime().local, it.getDateTime("completed")))
|
||||||
|
|
||||||
stdout.write ctx.formatSection(ctx.issues[state], state, "", verbose)
|
if isatty(stdout):
|
||||||
|
stdout.write ctx.formatSection(ctx.issues[state], state, "", verbose)
|
||||||
|
|
||||||
|
else:
|
||||||
|
stdout.writeLine ctx.issues[state]
|
||||||
|
.mapIt(formatPlainIssueSummary(it))
|
||||||
|
.join("\n")
|
||||||
|
|
||||||
|
|
||||||
trace "listing complete"
|
trace "listing complete"
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -279,7 +305,13 @@ proc list(
|
|||||||
not (it.hasProp("hide-until") and
|
not (it.hasProp("hide-until") and
|
||||||
it.getDateTime("hide-until") > getTime().local))
|
it.getDateTime("hide-until") > getTime().local))
|
||||||
|
|
||||||
stdout.write ctx.formatSection(visibleIssues, s, indent, verbose)
|
if isatty(stdout):
|
||||||
|
stdout.write ctx.formatSection(visibleIssues, s, indent, verbose)
|
||||||
|
|
||||||
|
else:
|
||||||
|
stdout.writeLine visibleIssues
|
||||||
|
.mapIt(formatPlainIssueSummary(it))
|
||||||
|
.join("\n")
|
||||||
|
|
||||||
# Future items
|
# Future items
|
||||||
if future:
|
if future:
|
||||||
@ -296,7 +328,13 @@ proc list(
|
|||||||
not (it.hasProp("hide-until") and
|
not (it.hasProp("hide-until") and
|
||||||
it.getDateTime("hide-until") > getTime().local))
|
it.getDateTime("hide-until") > getTime().local))
|
||||||
|
|
||||||
stdout.write ctx.formatSection(visibleIssues, s, indent, verbose)
|
if isatty(stdout):
|
||||||
|
stdout.write ctx.formatSection(visibleIssues, s, indent, verbose)
|
||||||
|
|
||||||
|
else:
|
||||||
|
stdout.writeLine visibleIssues
|
||||||
|
.mapIt(formatPlainIssueSummary(it))
|
||||||
|
.join("\n")
|
||||||
|
|
||||||
trace "listing complete"
|
trace "listing complete"
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const PIT_VERSION* = "4.24.1"
|
const PIT_VERSION* = "4.25.2"
|
||||||
|
|
||||||
const USAGE* = """Usage:
|
const USAGE* = """Usage:
|
||||||
pit ( new | add) <summary> [<state>] [options]
|
pit ( new | add) <summary> [<state>] [options]
|
||||||
|
@ -328,11 +328,16 @@ proc loadAllIssues*(tasksDir: string): TableRef[IssueState, seq[Issue]] =
|
|||||||
for state in IssueState: result[state] = tasksDir.loadIssues(state)
|
for state in IssueState: result[state] = tasksDir.loadIssues(state)
|
||||||
|
|
||||||
proc changeState*(issue: Issue, tasksDir: string, newState: IssueState) =
|
proc changeState*(issue: Issue, tasksDir: string, newState: IssueState) =
|
||||||
|
var dbgInfo = "[$#] changing state: $# → $#" %
|
||||||
|
[ ($issue.id)[0..<6], $issue.state, $newState ]
|
||||||
|
|
||||||
let oldFilepath = issue.filepath
|
let oldFilepath = issue.filepath
|
||||||
if newState == Done: issue.setDateTime("completed", getTime().local)
|
if newState == Done: issue.setDateTime("completed", getTime().local)
|
||||||
tasksDir.store(issue, newState)
|
tasksDir.store(issue, newState)
|
||||||
if oldFilePath != issue.filepath: removeFile(oldFilepath)
|
if oldFilePath != issue.filepath: removeFile(oldFilepath)
|
||||||
|
dbgInfo &= "\n\told path: $#\n\tnew path: $#" % [oldFilePath, issue.filepath]
|
||||||
issue.state = newState
|
issue.state = newState
|
||||||
|
debug dbgInfo
|
||||||
|
|
||||||
proc delete*(issue: Issue) = removeFile(issue.filepath)
|
proc delete*(issue: Issue) = removeFile(issue.filepath)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user