Move getIssueContextDisplayName to libpit (out of formatting module).
This commit is contained in:
@@ -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 cliutils, uuids
|
||||||
import std/strutils except alignLeft, capitalize, strip, toLower, toUpper
|
import std/strutils except alignLeft, capitalize, strip, toLower, toUpper
|
||||||
import ./libpit
|
import ./libpit
|
||||||
|
|
||||||
proc adjustedTerminalWidth(): int = min(terminalWidth(), 80)
|
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 =
|
proc formatIssue*(issue: Issue): string =
|
||||||
result = ($issue.id).withColor(fgBlack, true) & "\n"&
|
result = ($issue.id).withColor(fgBlack, true) & "\n"&
|
||||||
issue.summary.withColor(fgWhite) & "\n"
|
issue.summary.withColor(fgWhite) & "\n"
|
||||||
|
|||||||
@@ -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 cliutils, docopt, langutils, uuids, zero_functional
|
||||||
|
|
||||||
import nre except toSeq
|
import nre except toSeq
|
||||||
@@ -527,3 +528,9 @@ proc loadAllIssues*(ctx: CliContext) =
|
|||||||
proc filterIssues*(ctx: CliContext, filter: IssueFilter) =
|
proc filterIssues*(ctx: CliContext, filter: IssueFilter) =
|
||||||
for state, issueList in ctx.issues:
|
for state, issueList in ctx.issues:
|
||||||
ctx.issues[state] = issueList.filter(filter)
|
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]
|
||||||
|
|||||||
Reference in New Issue
Block a user