|
|
@ -41,6 +41,7 @@ type
|
|
|
|
isFromCompletion*: bool
|
|
|
|
isFromCompletion*: bool
|
|
|
|
|
|
|
|
|
|
|
|
const DONE_FOLDER_FORMAT* = "yyyy-MM"
|
|
|
|
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 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]+))?"
|
|
|
|
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 =
|
|
|
|
proc toStorageFormat*(issue: Issue, withComments = false): string =
|
|
|
|
var lines: seq[string] = @[]
|
|
|
|
var lines: seq[string] = @[]
|
|
|
|
|
|
|
|
|
|
|
|
if withComments: lines.add("# Summary (one line):")
|
|
|
|
if withComments: lines.add("# Summary (one line):")
|
|
|
|
lines.add(issue.summary)
|
|
|
|
lines.add(issue.summary)
|
|
|
|
|
|
|
|
|
|
|
|
if withComments: lines.add("# Properties (\"key:value\" per line):")
|
|
|
|
if withComments: lines.add("# Properties (\"key:value\" per line):")
|
|
|
|
|
|
|
|
issue.properties["last-updated"] = now().format(ISO8601_MS)
|
|
|
|
for key, val in issue.properties:
|
|
|
|
for key, val in issue.properties:
|
|
|
|
if not val.isEmptyOrWhitespace: lines.add(key & ": " & val)
|
|
|
|
if not val.isEmptyOrWhitespace: lines.add(key & ": " & val)
|
|
|
|
|
|
|
|
|
|
|
|
if issue.tags.len > 0: lines.add("tags: " & issue.tags.join(","))
|
|
|
|
if issue.tags.len > 0: lines.add("tags: " & issue.tags.join(","))
|
|
|
|
|
|
|
|
|
|
|
|
if not isEmptyOrWhitespace(issue.details) or withComments:
|
|
|
|
if not isEmptyOrWhitespace(issue.details) or withComments:
|
|
|
|
if withComments: lines.add("# Details go below the \"--------\"")
|
|
|
|
if withComments: lines.add("# Details go below the \"--------\"")
|
|
|
|
lines.add("--------")
|
|
|
|
lines.add("--------")
|
|
|
@ -326,6 +332,7 @@ proc changeState*(issue: Issue, tasksDir: string, newState: IssueState) =
|
|
|
|
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)
|
|
|
|
|
|
|
|
issue.state = newState
|
|
|
|
|
|
|
|
|
|
|
|
proc delete*(issue: Issue) = removeFile(issue.filepath)
|
|
|
|
proc delete*(issue: Issue) = removeFile(issue.filepath)
|
|
|
|
|
|
|
|
|
|
|
|