Add debug logging when changing the state of an issue.
This commit is contained in:
parent
9a0bf35882
commit
0c3d73dc2b
@ -1,6 +1,6 @@
|
||||
# Package
|
||||
|
||||
version = "4.25.1"
|
||||
version = "4.25.2"
|
||||
author = "Jonathan Bernard"
|
||||
description = "Personal issue tracker."
|
||||
license = "MIT"
|
||||
|
@ -1,4 +1,4 @@
|
||||
const PIT_VERSION* = "4.25.1"
|
||||
const PIT_VERSION* = "4.25.2"
|
||||
|
||||
const USAGE* = """Usage:
|
||||
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)
|
||||
|
||||
proc changeState*(issue: Issue, tasksDir: string, newState: IssueState) =
|
||||
var dbgInfo = "[$#] changing state: $# → $#" %
|
||||
[ ($issue.id)[0..<6], $issue.state, $newState ]
|
||||
|
||||
let oldFilepath = issue.filepath
|
||||
if newState == Done: issue.setDateTime("completed", getTime().local)
|
||||
tasksDir.store(issue, newState)
|
||||
if oldFilePath != issue.filepath: removeFile(oldFilepath)
|
||||
dbgInfo &= "\n\told path: $#\n\tnew path: $#" % [oldFilePath, issue.filepath]
|
||||
issue.state = newState
|
||||
debug dbgInfo
|
||||
|
||||
proc delete*(issue: Issue) = removeFile(issue.filepath)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user