Include issues without project or milestone on boards.
In order to help organize issues, show issues on boards even if they don't have an assigned project or milestone. Refactor the issue hiding feature (using the `hide-until` property) to be an option to IssueFilter rather than a separate, special-case. This means that the CLI always filters by default. Hide issues in the Done state on project boards unless the new `--show-done` arg is passed.
This commit is contained in:
26
src/pit.nim
26
src/pit.nim
@@ -172,8 +172,6 @@ when isMainModule:
|
||||
var exclTagsOption = none(seq[string])
|
||||
|
||||
let filter = initFilter()
|
||||
var filterOption = none(IssueFilter)
|
||||
|
||||
|
||||
if args["--properties"] or args["--context"]:
|
||||
|
||||
@@ -207,43 +205,37 @@ when isMainModule:
|
||||
# Initialize filter with properties (if given)
|
||||
if propertiesOption.isSome:
|
||||
filter.properties = propertiesOption.get
|
||||
filterOption = some(filter)
|
||||
|
||||
# Add property exclusions (if given)
|
||||
if exclPropsOption.isSome:
|
||||
filter.exclProperties = exclPropsOption.get
|
||||
filterOption = some(filter)
|
||||
|
||||
# If they supplied text matches, add that to the filter.
|
||||
if args["--match"]:
|
||||
filter.summaryMatch = some(re("(?i)" & $args["--match"]))
|
||||
filterOption = some(filter)
|
||||
|
||||
if args["--match-all"]:
|
||||
filter.fullMatch = some(re("(?i)" & $args["--match-all"]))
|
||||
filterOption = some(filter)
|
||||
|
||||
# If no "context" property is given, use the default (if we have one)
|
||||
if ctx.defaultContext.isSome and not filter.properties.hasKey("context"):
|
||||
stderr.writeLine("Limiting to default context: " & ctx.defaultContext.get)
|
||||
filter.properties["context"] = ctx.defaultContext.get
|
||||
filterOption = some(filter)
|
||||
|
||||
if tagsOption.isSome:
|
||||
filter.hasTags = tagsOption.get
|
||||
filterOption = some(filter)
|
||||
|
||||
if exclTagsOption.isSome:
|
||||
filter.exclTags = exclTagsOption.get
|
||||
filterOption = some(filter)
|
||||
|
||||
if args["--today"]:
|
||||
filter.inclStates.add(@[Current, TodoToday, Pending])
|
||||
filterOption = some(filter)
|
||||
|
||||
if args["--future"]:
|
||||
filter.inclStates.add(@[Pending, Todo])
|
||||
filterOption = some(filter)
|
||||
|
||||
if args["--show-hidden"]:
|
||||
filter.exclHidden = false
|
||||
|
||||
# Finally, if the "context" is "all", don't filter on context
|
||||
if filter.properties.hasKey("context") and
|
||||
@@ -433,7 +425,7 @@ when isMainModule:
|
||||
for state in statesOption.get: ctx.loadIssues(state)
|
||||
else: ctx.loadAllIssues()
|
||||
|
||||
if filterOption.isSome: ctx.filterIssues(filterOption.get)
|
||||
ctx.filterIssues(filter)
|
||||
|
||||
for state, issueList in ctx.issues:
|
||||
for issue in issueList:
|
||||
@@ -449,27 +441,27 @@ when isMainModule:
|
||||
stdout.writeLine formatIssue(issue)
|
||||
|
||||
# List projects
|
||||
elif listProjects: ctx.listProjects(filterOption)
|
||||
elif listProjects: ctx.listProjects(some(filter))
|
||||
|
||||
# List milestones
|
||||
elif listMilestones: ctx.listMilestones(filterOption)
|
||||
elif listMilestones: ctx.listMilestones(some(filter))
|
||||
|
||||
# List all issues
|
||||
else:
|
||||
trace "listing all issues"
|
||||
let showBoth = args["--today"] == args["--future"]
|
||||
ctx.list(
|
||||
filter = filterOption,
|
||||
filter = some(filter),
|
||||
states = statesOption,
|
||||
showToday = showBoth or args["--today"],
|
||||
showFuture = showBoth or args["--future"],
|
||||
showHidden = args["--show-hidden"],
|
||||
verbose = ctx.verbose)
|
||||
|
||||
elif args["show"]:
|
||||
|
||||
if args["project-board"]:
|
||||
ctx.showProjectBoard(filterOption)
|
||||
if not args["--show-done"]: filter.exclStates.add(Done)
|
||||
ctx.showProjectBoard(some(filter))
|
||||
discard
|
||||
|
||||
elif args["dupes"]:
|
||||
|
||||
Reference in New Issue
Block a user