Update state field when changing an issue's state.
This commit is contained in:
parent
171adbb59d
commit
fee4ba70a6
@ -1,6 +1,6 @@
|
||||
# Package
|
||||
|
||||
version = "4.23.0"
|
||||
version = "4.23.1"
|
||||
author = "Jonathan Bernard"
|
||||
description = "Personal issue tracker."
|
||||
license = "MIT"
|
||||
|
@ -1,4 +1,4 @@
|
||||
const PIT_VERSION* = "4.23.0"
|
||||
const PIT_VERSION* = "4.23.1"
|
||||
|
||||
const USAGE* = """Usage:
|
||||
pit ( new | add) <summary> [<state>] [options]
|
||||
|
@ -41,6 +41,7 @@ type
|
||||
isFromCompletion*: bool
|
||||
|
||||
const DONE_FOLDER_FORMAT* = "yyyy-MM"
|
||||
const ISO8601_MS = "yyyy-MM-dd'T'HH:mm:ss'.'fffzzz"
|
||||
|
||||
let ISSUE_FILE_PATTERN = re"[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}\.txt"
|
||||
let RECURRENCE_PATTERN = re"(every|after) ((\d+) )?((hour|day|week|month|year)s?)(, ([0-9a-fA-F]+))?"
|
||||
@ -219,12 +220,17 @@ proc fromStorageFormat*(id: string, issueTxt: string): Issue =
|
||||
|
||||
proc toStorageFormat*(issue: Issue, withComments = false): string =
|
||||
var lines: seq[string] = @[]
|
||||
|
||||
if withComments: lines.add("# Summary (one line):")
|
||||
lines.add(issue.summary)
|
||||
|
||||
if withComments: lines.add("# Properties (\"key:value\" per line):")
|
||||
issue.properties["last-updated"] = now().format(ISO8601_MS)
|
||||
for key, val in issue.properties:
|
||||
if not val.isEmptyOrWhitespace: lines.add(key & ": " & val)
|
||||
|
||||
if issue.tags.len > 0: lines.add("tags: " & issue.tags.join(","))
|
||||
|
||||
if not isEmptyOrWhitespace(issue.details) or withComments:
|
||||
if withComments: lines.add("# Details go below the \"--------\"")
|
||||
lines.add("--------")
|
||||
@ -326,6 +332,7 @@ proc changeState*(issue: Issue, tasksDir: string, newState: IssueState) =
|
||||
if newState == Done: issue.setDateTime("completed", getTime().local)
|
||||
tasksDir.store(issue, newState)
|
||||
if oldFilePath != issue.filepath: removeFile(oldFilepath)
|
||||
issue.state = newState
|
||||
|
||||
proc delete*(issue: Issue) = removeFile(issue.filepath)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user