list contexts command now prints both the listeral context value and the display name.

This commit is contained in:
Jonathan Bernard 2020-05-05 09:40:08 -05:00
parent 0a2249018b
commit 339e88cddd
4 changed files with 13 additions and 5 deletions

View File

@ -1,6 +1,6 @@
# Package # Package
version = "4.8.0" version = "4.9.0"
author = "Jonathan Bernard" author = "Jonathan Bernard"
description = "Personal issue tracker." description = "Personal issue tracker."
license = "MIT" license = "MIT"

View File

@ -5,7 +5,7 @@ import cliutils, docopt, json, logging, options, os, sequtils,
tables, terminal, times, timeutils, unicode, uuids tables, terminal, times, timeutils, unicode, uuids
from nre import re from nre import re
import strutils except capitalize, strip, toUpper, toLower import strutils except alignLeft, capitalize, strip, toUpper, toLower
import pitpkg/private/libpit import pitpkg/private/libpit
export libpit export libpit
@ -490,7 +490,13 @@ Options:
if issue.hasProp("context") and not uniqContexts.contains(issue["context"]): if issue.hasProp("context") and not uniqContexts.contains(issue["context"]):
uniqContexts.add(issue["context"]) uniqContexts.add(issue["context"])
for c in uniqContexts: stdout.writeLine(c) let maxLen = foldl(uniqContexts,
if a.len > b.len: a
else: b
).len
for c in uniqContexts:
stdout.writeLine(c.alignLeft(maxLen+2) & ctx.getIssueContextDisplayName(c))
# List a specific issue # List a specific issue
elif issueIdOption.isSome: elif issueIdOption.isSome:

View File

@ -1,4 +1,4 @@
import cliutils, docopt, json, logging, langutils, options, os, ospaths, import cliutils, docopt, json, logging, langutils, options, os,
sequtils, strutils, tables, times, timeutils, uuids sequtils, strutils, tables, times, timeutils, uuids
from nre import find, match, re, Regex from nre import find, match, re, Regex
@ -49,6 +49,7 @@ proc `[]`*(issue: Issue, key: string): string =
proc `[]=`*(issue: Issue, key: string, value: string) = proc `[]=`*(issue: Issue, key: string, value: string) =
issue.properties[key] = value issue.properties[key] = value
## Issue property accessors
proc hasProp*(issue: Issue, key: string): bool = proc hasProp*(issue: Issue, key: string): bool =
return issue.properties.hasKey(key) return issue.properties.hasKey(key)
@ -62,6 +63,7 @@ proc getDateTime*(issue: Issue, key: string, default: DateTime): DateTime =
proc setDateTime*(issue: Issue, key: string, dt: DateTime) = proc setDateTime*(issue: Issue, key: string, dt: DateTime) =
issue.properties[key] = dt.formatIso8601 issue.properties[key] = dt.formatIso8601
## Issue filtering
proc initFilter*(): IssueFilter = proc initFilter*(): IssueFilter =
result = IssueFilter( result = IssueFilter(
completedRange: none(tuple[b, e: DateTime]), completedRange: none(tuple[b, e: DateTime]),

View File

@ -1 +1 @@
const PIT_VERSION* = "4.8.0" const PIT_VERSION* = "4.9.0"