Move getIssueContextDisplayName to libpit (out of formatting module).

This commit is contained in:
2025-11-19 17:11:21 -06:00
parent 759d00e2f8
commit 6ac068fe75
2 changed files with 9 additions and 9 deletions

View File

@@ -1,17 +1,10 @@
import std/[options, sequtils, wordwrap, tables, terminal, times, unicode, wordwrap]
import std/[options, sequtils, tables, terminal, times, unicode, wordwrap]
import cliutils, uuids
import std/strutils except alignLeft, capitalize, strip, toLower, toUpper
import ./libpit
proc adjustedTerminalWidth(): int = min(terminalWidth(), 80)
proc getIssueContextDisplayName*(ctx: CliContext, context: string): string =
if not ctx.contexts.hasKey(context):
if context.isEmptyOrWhitespace: return "<default>"
else: return context.capitalize()
return ctx.contexts[context]
proc formatIssue*(issue: Issue): string =
result = ($issue.id).withColor(fgBlack, true) & "\n"&
issue.summary.withColor(fgWhite) & "\n"

View File

@@ -1,4 +1,5 @@
import std/[json, logging, options, os, strformat, strutils, tables, times]
import std/[json, logging, options, os, strformat, strutils, tables, times,
unicode]
import cliutils, docopt, langutils, uuids, zero_functional
import nre except toSeq
@@ -527,3 +528,9 @@ proc loadAllIssues*(ctx: CliContext) =
proc filterIssues*(ctx: CliContext, filter: IssueFilter) =
for state, issueList in ctx.issues:
ctx.issues[state] = issueList.filter(filter)
proc getIssueContextDisplayName*(ctx: CliContext, context: string): string =
if not ctx.contexts.hasKey(context):
if context.isEmptyOrWhitespace: return "<default>"
else: return context.capitalize()
return ctx.contexts[context]