Include Pending in the 'today' view. Allow listing multiple issues or states.
This commit is contained in:
parent
d93c0cf348
commit
e0ab3cb401
@ -1,6 +1,6 @@
|
|||||||
# Package
|
# Package
|
||||||
|
|
||||||
version = "4.13.0"
|
version = "4.14.0"
|
||||||
author = "Jonathan Bernard"
|
author = "Jonathan Bernard"
|
||||||
description = "Personal issue tracker."
|
description = "Personal issue tracker."
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
32
src/pit.nim
32
src/pit.nim
@ -196,22 +196,23 @@ proc edit(issue: Issue) =
|
|||||||
getCurrentExceptionMsg()
|
getCurrentExceptionMsg()
|
||||||
issue.store()
|
issue.store()
|
||||||
|
|
||||||
proc list(ctx: CliContext, filter: Option[IssueFilter], state: Option[IssueState], showToday, showFuture, verbose: bool) =
|
proc list(ctx: CliContext, filter: Option[IssueFilter], states: Option[seq[IssueState]], showToday, showFuture, verbose: bool) =
|
||||||
|
|
||||||
if state.isSome:
|
if states.isSome:
|
||||||
ctx.loadIssues(state.get)
|
for state in states.get:
|
||||||
|
ctx.loadIssues(state)
|
||||||
if filter.isSome: ctx.filterIssues(filter.get)
|
if filter.isSome: ctx.filterIssues(filter.get)
|
||||||
if state.get == Done and showToday:
|
if state == Done and showToday:
|
||||||
ctx.issues[Done] = ctx.issues[Done].filterIt(
|
ctx.issues[Done] = ctx.issues[Done].filterIt(
|
||||||
it.hasProp("completed") and
|
it.hasProp("completed") and
|
||||||
sameDay(getTime().local, it.getDateTime("completed")))
|
sameDay(getTime().local, it.getDateTime("completed")))
|
||||||
stdout.write ctx.formatSection(ctx.issues[state.get], state.get, "", verbose)
|
stdout.write ctx.formatSection(ctx.issues[state], state, "", verbose)
|
||||||
return
|
return
|
||||||
|
|
||||||
ctx.loadAllIssues()
|
ctx.loadAllIssues()
|
||||||
if filter.isSome: ctx.filterIssues(filter.get)
|
if filter.isSome: ctx.filterIssues(filter.get)
|
||||||
|
|
||||||
let today = showToday and [Current, TodoToday].anyIt(
|
let today = showToday and [Current, TodoToday, Pending].anyIt(
|
||||||
ctx.issues.hasKey(it) and ctx.issues[it].len > 0)
|
ctx.issues.hasKey(it) and ctx.issues[it].len > 0)
|
||||||
|
|
||||||
let future = showFuture and [Pending, Todo].anyIt(
|
let future = showFuture and [Pending, Todo].anyIt(
|
||||||
@ -223,7 +224,7 @@ proc list(ctx: CliContext, filter: Option[IssueFilter], state: Option[IssueState
|
|||||||
if today:
|
if today:
|
||||||
if future: ctx.writeHeader("Today")
|
if future: ctx.writeHeader("Today")
|
||||||
|
|
||||||
for s in [Current, TodoToday]:
|
for s in [Current, TodoToday, Pending]:
|
||||||
if ctx.issues.hasKey(s) and ctx.issues[s].len > 0:
|
if ctx.issues.hasKey(s) and ctx.issues[s].len > 0:
|
||||||
stdout.write ctx.formatSection(ctx.issues[s], s, indent, verbose)
|
stdout.write ctx.formatSection(ctx.issues[s], s, indent, verbose)
|
||||||
|
|
||||||
@ -246,7 +247,7 @@ when isMainModule:
|
|||||||
Usage:
|
Usage:
|
||||||
pit ( new | add) <summary> [<state>] [options]
|
pit ( new | add) <summary> [<state>] [options]
|
||||||
pit list contexts [options]
|
pit list contexts [options]
|
||||||
pit list [<stateOrId>] [options]
|
pit list [<stateOrId>...] [options]
|
||||||
pit ( start | done | pending | todo-today | todo | suspend ) <id>... [options]
|
pit ( start | done | pending | todo-today | todo | suspend ) <id>... [options]
|
||||||
pit edit <ref>... [options]
|
pit edit <ref>... [options]
|
||||||
pit tag <id>... [options]
|
pit tag <id>... [options]
|
||||||
@ -490,13 +491,13 @@ Options:
|
|||||||
filter.properties.del("context")
|
filter.properties.del("context")
|
||||||
|
|
||||||
var listContexts = false
|
var listContexts = false
|
||||||
var stateOption = none(IssueState)
|
var statesOption = none(seq[IssueState])
|
||||||
var issueIdOption = none(string)
|
var issueIdsOption = none(seq[string])
|
||||||
|
|
||||||
if args["contexts"]: listContexts = true
|
if args["contexts"]: listContexts = true
|
||||||
elif args["<stateOrId>"]:
|
elif args["<stateOrId>"]:
|
||||||
try: stateOption = some(parseEnum[IssueState]($args["<stateOrId>"]))
|
try: statesOption = some(args["<stateOrId>"].mapIt(parseEnum[IssueState]($it)))
|
||||||
except: issueIdOption = some($args["<stateOrId>"])
|
except: issueIdsOption = some(args["<stateOrId>"].mapIt($it))
|
||||||
|
|
||||||
# List the known contexts
|
# List the known contexts
|
||||||
if listContexts:
|
if listContexts:
|
||||||
@ -516,14 +517,15 @@ Options:
|
|||||||
stdout.writeLine(c.alignLeft(maxLen+2) & ctx.getIssueContextDisplayName(c))
|
stdout.writeLine(c.alignLeft(maxLen+2) & ctx.getIssueContextDisplayName(c))
|
||||||
|
|
||||||
# List a specific issue
|
# List a specific issue
|
||||||
elif issueIdOption.isSome:
|
elif issueIdsOption.isSome:
|
||||||
let issue = ctx.tasksDir.loadIssueById(issueIdOption.get)
|
for issueId in issueIdsOption.get:
|
||||||
|
let issue = ctx.tasksDir.loadIssueById(issueId)
|
||||||
stdout.writeLine ctx.formatIssue(issue)
|
stdout.writeLine ctx.formatIssue(issue)
|
||||||
|
|
||||||
# List all issues
|
# List all issues
|
||||||
else:
|
else:
|
||||||
let showBoth = args["--today"] == args["--future"]
|
let showBoth = args["--today"] == args["--future"]
|
||||||
ctx.list(filterOption, stateOption, showBoth or args["--today"],
|
ctx.list(filterOption, statesOption, showBoth or args["--today"],
|
||||||
showBoth or args["--future"],
|
showBoth or args["--future"],
|
||||||
ctx.verbose)
|
ctx.verbose)
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
const PIT_VERSION* = "4.13.0"
|
const PIT_VERSION* = "4.14.0"
|
Loading…
x
Reference in New Issue
Block a user