diff --git a/pit.nimble b/pit.nimble index 90a692e..11bd408 100644 --- a/pit.nimble +++ b/pit.nimble @@ -12,4 +12,4 @@ bin = @["pit", "pit_api"] # Dependencies requires @[ "nim >= 0.19.0", "cliutils 0.6.1", "docopt 0.6.8", "jester 0.4.1", - "langutils >= 0.4.0", "timeutils 0.3.0", "uuids 0.1.10" ] + "langutils >= 0.4.0", "timeutils 0.4.0", "uuids 0.1.10" ] diff --git a/src/pit.nim b/src/pit.nim index 72c210e..3054fba 100644 --- a/src/pit.nim +++ b/src/pit.nim @@ -76,11 +76,21 @@ proc formatSectionIssue(ctx: CliContext, issue: Issue, width: int, indent = "", var showDetails = not issue.details.isNilOrWhitespace and verbose - # Wrap and write the summary. - var wrappedSummary = (" ".repeat(5) & issue.summary).wordWrap(width - 2).indent(2 + indent.len) - wrappedSummary = wrappedSummary[(6 + indent.len)..^1] + var prefixLen = 0 + var summaryIndentLen = indent.len + 7 + + if issue.hasProp("delegated-to"): prefixLen += issue["delegated-to"].len + 2 # space for the ':' and ' ' + + # Wrap and write the summary. + var wrappedSummary = ("+".repeat(prefixLen) & issue.summary).wordWrap(width - summaryIndentLen).indent(summaryIndentLen) + + wrappedSummary = wrappedSummary[(prefixLen + summaryIndentLen)..^1] + + result = (indent & ($issue.id)[0..<6]).withColor(fgBlack, true) & " " + + if issue.hasProp("delegated-to"): + result &= (issue["delegated-to"] & ": ").withColor(fgGreen) - result = (indent & ($issue.id)[0..<6]).withColor(fgBlack, true) result &= wrappedSummary.withColor(fgWhite) if issue.tags.len > 0: @@ -92,9 +102,9 @@ proc formatSectionIssue(ctx: CliContext, issue: Issue, width: int, indent = "", if issue.hasProp("pending"): let startIdx = "Pending: ".len - var pendingText = issue["pending"].wordWrap(width - startIdx - 2) + var pendingText = issue["pending"].wordWrap(width - startIdx - summaryIndentLen) .indent(startIdx) - pendingText = ("Pending: " & pendingText[startIdx..^1]).indent(indent.len + 2) + pendingText = ("Pending: " & pendingText[startIdx..^1]).indent(summaryIndentLen) result &= "\n" & pendingText.withColor(fgCyan) if showDetails: @@ -106,16 +116,9 @@ proc formatSectionIssueList(ctx: CliContext, issues: seq[Issue], width: int, indent: string, verbose: bool): string = result = "" - var topPadded = true for i in issues: var issueText = ctx.formatSectionIssue(i, width, indent, verbose) - if issueText.splitLines.len > 1: - if topPadded: result &= issueText & "\n\n" - else: result &= "\n" & issueText & "\n\n" - topPadded = true - else: - result &= issueText & "\n" - topPadded = false + result &= issueText & "\n" proc formatSection(ctx: CliContext, issues: seq[Issue], state: IssueState, indent = "", verbose = false): string = @@ -242,6 +245,7 @@ Usage: pit ( start | done | pending | todo-today | todo | suspend ) ... [options] pit edit ... pit reorder + pit delegate pit ( delete | rm ) ... Options: @@ -382,6 +386,13 @@ Options: elif targetState == Done or targetState == Pending: discard execShellCmd("ptk stop") + elif args["delegate"]: + + let issue = ctx.tasksDir.loadIssueById($(args[""])) + issue["delegated-to"] = $args[""] + + issue.store() + elif args["delete"] or args["rm"]: for id in @(args[""]): diff --git a/src/pitpkg/version.nim b/src/pitpkg/version.nim index 9073d69..1fe3d71 100644 --- a/src/pitpkg/version.nim +++ b/src/pitpkg/version.nim @@ -1 +1 @@ -const PIT_VERSION* = "4.4.3" +const PIT_VERSION* = "4.4.4"