list contexts
command now prints both the listeral context value and the display name.
This commit is contained in:
parent
0a2249018b
commit
339e88cddd
@ -1,6 +1,6 @@
|
||||
# Package
|
||||
|
||||
version = "4.8.0"
|
||||
version = "4.9.0"
|
||||
author = "Jonathan Bernard"
|
||||
description = "Personal issue tracker."
|
||||
license = "MIT"
|
||||
|
10
src/pit.nim
10
src/pit.nim
@ -5,7 +5,7 @@ import cliutils, docopt, json, logging, options, os, sequtils,
|
||||
tables, terminal, times, timeutils, unicode, uuids
|
||||
|
||||
from nre import re
|
||||
import strutils except capitalize, strip, toUpper, toLower
|
||||
import strutils except alignLeft, capitalize, strip, toUpper, toLower
|
||||
import pitpkg/private/libpit
|
||||
export libpit
|
||||
|
||||
@ -490,7 +490,13 @@ Options:
|
||||
if issue.hasProp("context") and not uniqContexts.contains(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
|
||||
elif issueIdOption.isSome:
|
||||
|
@ -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
|
||||
|
||||
from nre import find, match, re, Regex
|
||||
@ -49,6 +49,7 @@ proc `[]`*(issue: Issue, key: string): string =
|
||||
proc `[]=`*(issue: Issue, key: string, value: string) =
|
||||
issue.properties[key] = value
|
||||
|
||||
## Issue property accessors
|
||||
proc hasProp*(issue: Issue, key: string): bool =
|
||||
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) =
|
||||
issue.properties[key] = dt.formatIso8601
|
||||
|
||||
## Issue filtering
|
||||
proc initFilter*(): IssueFilter =
|
||||
result = IssueFilter(
|
||||
completedRange: none(tuple[b, e: DateTime]),
|
||||
|
@ -1 +1 @@
|
||||
const PIT_VERSION* = "4.8.0"
|
||||
const PIT_VERSION* = "4.9.0"
|
Loading…
x
Reference in New Issue
Block a user