diff --git a/src/pit/formatting.nim b/src/pit/formatting.nim index e65f963..a0399ca 100644 --- a/src/pit/formatting.nim +++ b/src/pit/formatting.nim @@ -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 "" - 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" diff --git a/src/pit/libpit.nim b/src/pit/libpit.nim index bbde607..ba8b8ed 100644 --- a/src/pit/libpit.nim +++ b/src/pit/libpit.nim @@ -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 "" + else: return context.capitalize() + return ctx.contexts[context]