Project boards: only show contexts with selected issues.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const PIT_VERSION* = "4.30.0"
|
||||
const PIT_VERSION* = "4.30.1"
|
||||
|
||||
const USAGE* = """Usage:
|
||||
pit ( new | add) <summary> [<state>] [options]
|
||||
@@ -235,4 +235,4 @@ Issue Properties:
|
||||
|
||||
If present, expected to be a comma-delimited list of text tags. The -g
|
||||
option is a short-hand for '-p tags:<tags-value>'.
|
||||
"""
|
||||
"""
|
||||
@@ -1,5 +1,5 @@
|
||||
import std/[algorithm, json, jsonutils, options, os, sets, strutils, tables, terminal,
|
||||
times, unicode, wordwrap]
|
||||
import std/[algorithm, json, jsonutils, options, os, sets, strutils, tables,
|
||||
terminal, times, unicode, wordwrap]
|
||||
from std/sequtils import repeat, toSeq
|
||||
import cliutils, uuids, zero_functional
|
||||
import ./[formatting, libpit]
|
||||
@@ -256,8 +256,7 @@ proc formatMilestone*(
|
||||
result.add(withColor("─".repeat(availWidth), fgWhite))
|
||||
|
||||
var parentsToChildren = issues -->
|
||||
filter(it.hasProp("parent")) -->
|
||||
group(it["parent"])
|
||||
filter(it.hasProp("parent")).group(it["parent"])
|
||||
|
||||
var issuesToFormat = sorted(issues, cmp) -->
|
||||
filter(not it.hasProp("parent"))
|
||||
@@ -282,7 +281,7 @@ proc findShortestColumn(columns: seq[seq[string]]): int =
|
||||
|
||||
|
||||
proc joinColumns(columns: seq[seq[string]], columnWidth: int): seq[string] =
|
||||
let maxLines = columns --> map(it.len) --> max()
|
||||
let maxLines = columns --> map(it.len).max()
|
||||
|
||||
for lineNo in 0 ..< maxLines:
|
||||
var newLine = ""
|
||||
@@ -316,7 +315,7 @@ proc showProject*(ctx: CliContext, project: Project) =
|
||||
fgBlue, bold=true))
|
||||
|
||||
let milestoneTexts: seq[seq[string]] = project.milestoneOrder -->
|
||||
filter(project.milestones.hasKey(it) and project.milestones[it].len > 0) -->
|
||||
filter(project.milestones.hasKey(it) and project.milestones[it].len > 0).
|
||||
map(ctx.formatMilestone(it, project.milestones[it], columnWidth))
|
||||
|
||||
var columns: seq[seq[string]] = repeat(newSeq[string](), numColumns)
|
||||
@@ -347,8 +346,16 @@ proc showProjectBoard*(ctx: CliContext, filter = none[IssueFilter]()) =
|
||||
let projectsCfg = ctx.loadProjectsConfiguration()
|
||||
let projectsDb = ctx.buildDb(projectsCfg)
|
||||
|
||||
for (context, projects) in pairs(projectsDb):
|
||||
if projectsDb.len > 1:
|
||||
var contextsAndProjects: seq[(string, seq[Project])] = @[]
|
||||
|
||||
for (context, pjs) in pairs(projectsDb):
|
||||
let projects = pjs
|
||||
let issues: seq[Issue] = projects --> map(toSeq(values(it.milestones))).flatten().flatten()
|
||||
if issues.len > 0:
|
||||
contextsAndProjects.add((context, projects))
|
||||
|
||||
for (context, projects) in contextsAndProjects:
|
||||
if contextsAndProjects.len > 1:
|
||||
stdout.writeLine("")
|
||||
stdout.writeLine(withColor(
|
||||
ctx.getIssueContextDisplayName(context) & ":",
|
||||
|
||||
Reference in New Issue
Block a user